I'm trying to add this custom message using the below code but it's showing the default message. please help me where I'm doing wrong thanks in advance
window.addEventListener("beforeunload", (ev) => {
ev.preventDefault();
return ev.returnValue = 'Are you sure you want to close?';
});