The defer attribute causes the JQuery reference page to report "The browser cannot open website xxx, the operation is aborted" error Solution

Source: Internet
Author: User

JQuery is used in An aspx page, but when the Internet Explorer 6 opens this page, it will report "Internet Explorer cannot open the Internet site http: // localhost: 9001/Index. aspx. operation aborted "error, and then the page cannot be browsed normally. This problem does not occur if you use IE7 or IE8.


Use "<! --> Mark the comment (this can cause problems, but at least you can browse this page ). Check one by one and find the problem:

Copy codeThe Code is as follows:
<Script src = "Jquery/DatePicker/WdatePicker. js" type = "text/javascript"> </script>



This is a problem caused by this line of statements. After commenting on this line, the page can be browsed normally.

The query found that the referenced js script operated on a page element that has not yet been loaded, which solved the problem well. After adding the "defer" attribute to the <script> script, the page can be browsed normally.

Copy codeThe Code is as follows:
<Script defer = "defer" src = "Jquery/DatePicker/WdatePicker. js" type = "text/javascript"> </script>


References:

Defer attribute in Script
If you are a person who cares about and cares about system performance, I think you should be interested in defer in the Script.
The defer attribute in script is false by default. According to the descriptions in the DHTML programming guide, the Defer attribute is written as follows:
Using the attribute at design time can improve the download performance of a page because the browser does not need to parse and execute the script and can continue downloading and parsing the page instead.
That is to say, if the defer attribute is added during script writing, the browser does not need to process the script immediately when downloading the script, but continues to download and parse the page, this will improve the download performance.
There are many such cases. For example, you have defined many javascript variables, or (. inc) has written a lot of scripts to be processed, so you may wish to add the defer attribute to these scripts to improve performance.
Example:
<Script language = "javascript" defer>
Var object = new Object ();
....
</Script>
Because the default defer attribute is false, <script language = "javascript" defer> explicitly declaring the defer attribute is equivalent to <script language = "javascript" defer = true>
After the defer attribute is declared, you must determine whether other variables reference the variables in the defer script block. Otherwise, script errors may occur.

I looked up and the stars gave me hope ......

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.