In ie9, alert blocks jsp rendering in ie8. No problem.

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.