window.onbeforeunload IE . " ".
href= "javascript:...." (ASP.Net LinkButton ), IE .
dirtyflag
var __ignoreDirtyFlag = false;
$(document).ready(function () {
if ($.browser.msie) {
$('[href^="javascript:"]').bind('click.ignoreDirtyFlag', function () {
__ignoreDirtyFlag = true;
});
}
});
, , , href ^ = "javascript:", . , __ingoreDirtyFlag ;
window.onbeforeunload = function globalWindowUnload() {
if (!__ignoreDirtyFlag && isDataFilled == true) {
return "You have unsaved changes on this page. If you leave this page, those changes will be lost.";
}
__ignoreDirtyFlag = false;
return;
};
- asp, , .
, .
,
function foo() {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);
}
function endRequestHandler(sender, args) {
if ($.browser.msie) {
$('[href^="javascript:"]').bind('click.ignoreDirtyFlag', function () {
__ignoreDirtyFlag = true;
});
}
}
body, foo().
<body onload="foo()">
IE :)