JSSP rendering under ie9 may be blocked by alert. There is no problem with ie8.
Problem description:
A jsp, using JQuery to bind the screen initialization event ($(function()), there is alert() in the initialization event,
The moment the message dialog pops up in IE8, the jsp page is normally rendered in the browser;
However, in IE9, the message dialog box pops up in the alert instantly. The jsp page is not rendered, and a white page is displayed. When you click "OK" in the alert, the page will be rendered.
How can I achieve the same effect as IE8 in IE9?
I tried the compatibility mode of ie9, but it didn't work. Forced use of ie8 parsing mode in Jsp code will not work.
Solution:
By wrapping alert or confirm a layer setTimeout.
$(document).ready(function() {
setTimeout(test,0);
});
function test() {
if(confirm('OK?')) {
alert("think you!");
}
}
Conclusion of guesses:
SetTimeout can solve the problem.
setTimeout("alert('XXX')", 0 );
This problem under ie9 has nothing to do with JQuery. After using setTimeout, another thread should be restarted to alert, so that the normal rendering of jsp will not be prevented.
Problem description:
A jsp, using JQuery to bind the screen initialization event ($(function()), there is alert() in the initialization event,
The moment the message dialog pops up in IE8, the jsp page is normally rendered in the browser;
However, in IE9, the message dialog box pops up in the alert instantly. The jsp page is not rendered, and a white page is displayed. When you click "OK" in the alert, the page will be rendered.
How can I achieve the same effect as IE8 in IE9?
I tried the compatibility mode of ie9, but it didn't work. Forced use of ie8 parsing mode in Jsp code will not work.
Solution:
By wrapping alert or confirm a layer setTimeout.
Copy the codeThe code is as follows:
$(document).ready(function() {
setTimeout(test,0);
});
function test() {
if(confirm('OK?')) {
alert("think you!");
}
}
Conclusion of guesses:
SetTimeout can solve the problem.
setTimeout("alert('XXX')", 0 );
This problem under ie9 has nothing to do with JQuery. After using setTimeout, another thread should be restarted to alert, so that the normal rendering of jsp will not be prevented.