Not Implemented IE8: Working around this?
I get an error on this line in IE8 with the Not Implemented error. How do i execute this line on other brows开发者_Python百科ers and have IE8 ignore this?
window.onbeforeunload = function () {
This is weird. Theres nothing inside of this that should cause an error. This script is loaded at the end of body so all html exist and moving this code to the bottom on the file solved it. why?
window.onbeforeunload = function () {
var txtbox = $('.box textarea').eq(0);
var txt = txtbox.val();
var btn = $('.box button').eq(0).html();
if (btn == "Thank You")
return;
if (btn == "Sending")
return "not complete";
if (txt != '') {
return "blah"
}
return;
}
Use conditional comments, which means put a
<!--[if !(IE 8)]>
<![endif]-->
arround your < script>-block
<!--[if !(IE 8)]>
<script type="text/javascript">
window.onbeforeunload = function () {
[...]
}
</script>
<![endif]-->
You might be able to use Conditional Compilation, the JS equivalent of Conditional Comments.
Not sure that you can do a browser sniff though.
精彩评论