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.
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.
a source to share