Sunday, December 14, 2008

Why I do not use the popup dialog of onbeforeunload for leaving page warning?

Quote from http://msdn.microsoft.com/en-us/library/ms536907(VS.85).aspx:

"
function closeIt()
{
return "Any string value here forces a dialog box to \
appear before closing the window.";
}
window.onbeforeunload=closeIt;

When a string is assigned to the returnValue property of window.event, a dialog box appears that gives users the option to stay on the current page and retain the string that was assigned to it. The default statement that appears in the dialog box, "Are you sure you want to navigate away from this page? ... Press OK to continue, or Cancel to stay on the current page.", cannot be removed or altered.
"

My experience is that the default string "Are you..." cannot be localized. This is the reason why I do not use in my portal.

No comments: