Window.onbeforeunload message localization

I am using a page unload trigger to alert the user of unsaved changes by leaving the page / closing the / etc ... tab and that works great.

//Exit event
if (!changes_saved) {
    window.onbeforeunload = confirmExit;    
}
function confirmExit()
{
  return "Your changes will be lost if you leave this page!";
}

      

My problem is that the browser (both Firefox and IE) includes a custom message with "Do you really want to go from this page" at the beginning and with "Click OK" to continue, or "Cancel" to stay on the current page ". at the end.

My question is, is there a way to avoid this and completely customize the message in the dialog? The need for this is not abstract, I am developing a multilingual interface, and the localized message mixed with the forced one looks just silly.

Thanks.

+1


a source to share


2 answers


This question has been asked before .

Apparently changing this standard dialog is not possible due to browser security. If possible, it would allow an attacker to trick you into the page.



However, the message language is based on the language setting of the user's machine, just like any other standard dialog.

+4


a source


I am afraid this is not possible. If there was the same problem once, he searched for it and found a link to msdn saying it couldn't be done (for IE at least, which was what I was concerned about by then).



I cannot find this link again.

0


a source







All Articles