In ie9, jsp rendering may be blocked by alert. There is no problem in ie8.
Problem description:
A jsp uses JQuery to bind an initial event ($ (function () to the image. The initial event contains alert (),
When the message dialog box pops up in alert under IE8, the jsp page is rendered normally in the browser;
However, in IE9, when the alert pop-up message dialog box is displayed, the jsp page is not rendered and a white page is displayed. When you click "OK" in alert, the page is rendered.
In IE9, how can we achieve the same effect as in IE8?
The compatibility mode of ie9 does not work. The forced use of ie8 resolution mode in Jsp code does not work either.
Solution:
Encapsulate a layer of setTimeout by alert or confirm.
Copy codeThe Code is as follows:
$ (Document). ready (function (){
SetTimeout (test, 0 );
});
Function test (){
If (confirm ('OK? ')){
Alert ("think you! ");
}
}
Conclusion:
The setTimeout method can be used to solve the problem.
SetTimeout ("alert ('xxx')", 0 );
In ie9, this problem has nothing to do with JQuery. After setTimeout is used, another thread should be restarted for alert, so that the normal rendering of jsp will not be blocked.