admin管理员组文章数量:1327693
if(!$('fieldset.quote-step4').hasClass('show')) {
window.onbeforeunload = function() {
return "Are you sure you want to leave the quote request page? This will reset the form.";
}
} else {
window.onbeforeunload = undefined;
}
I have the above in a script inside of a private function that's causing a "not implemented" error in ie8.
The specific line that causes the error is: window.onbeforeunload = undefined;
From what I've read in other questions window
should be declared as a local variable to fix this issue-- but I'm not sure how.
Can anyone explain this bug to me and a possible solution?
Thank you!
if(!$('fieldset.quote-step4').hasClass('show')) {
window.onbeforeunload = function() {
return "Are you sure you want to leave the quote request page? This will reset the form.";
}
} else {
window.onbeforeunload = undefined;
}
I have the above in a script inside of a private function that's causing a "not implemented" error in ie8.
The specific line that causes the error is: window.onbeforeunload = undefined;
From what I've read in other questions window
should be declared as a local variable to fix this issue-- but I'm not sure how.
Can anyone explain this bug to me and a possible solution?
Thank you!
Share Improve this question asked Jun 14, 2013 at 19:14 HandiworkNYC.HandiworkNYC. 11.1k25 gold badges95 silver badges156 bronze badges 2- 2 Um, don't do that? What are you trying to do? – SLaks Commented Jun 14, 2013 at 19:18
- Edited question to show a little more detail – HandiworkNYC. Commented Jun 14, 2013 at 19:19
3 Answers
Reset to default 5Try this:
$(window).on('beforeunload', function() {
if($('fieldset.quote-step4').hasClass('show')) {
return;
}
return "Are you sure you want to leave the quote request page? This will reset the form.";
});
And it is not the best idea to use DOM1 Handlers when jQuery is already on your page.
window.onbeforeunload = function(){};
onbeforeunload
is an event handler; apparently; IE8 doesn't like clearing it.
You can simply set it to a function that doesn't return anything.
版权声明:本文标题:javascript - Setting window.onbeforeunload to undefined in IE8 causes" not implemented error - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742218501a2435006.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论