As per the project need, some settings are required to be saved when user closes the page. I use beforeunload event to save the settings.
$(window).unbind("beforeunload").bind("beforeunload", function (e) {
return SaveSettings(); // this call returns true.
});
It works fine in IE. But for Chrome and FireFox, a string value must be returned. After returning a string value, code workd in Chrome and FF but it shows a confirmation dialog "you are about to leave...".
Is there any way to avoid this dialog?
Thanks.