Home > Web Front-end > JS Tutorial > The defer attribute causes the page that references JQuery to report the error 'The browser cannot open the website xxx, the operation was aborted'_javascript skills

The defer attribute causes the page that references JQuery to report the error 'The browser cannot open the website xxx, the operation was aborted'_javascript skills

WBOY
Release: 2016-05-16 18:28:40
Original
1340 people have browsed it

JQuery is used in an aspx page, but when IE6 browser opens this page, it will report the error "Internet Explorer cannot open the Internet site http://localhost:9001/Index.aspx. Operation aborted", and then it cannot Browse this page normally. If you use IE7 or IE8, you won't have this problem.
Operationaborted

Comment out all js scripts using "" tags (this will cause problems, but at least you can browse this page). After checking one by one, I found the problem:

Copy the code The code is as follows:

< ;script src="Jquery/DatePicker/WdatePicker.js" type="text/javascript">



is the problem caused by this line of statement, After commenting this line, the page can be browsed normally.

The query found that the referenced js script operates a page element that has not yet been loaded. This solves the problem very well. After adding the "defer" attribute to the <script> script, the page can be browsed normally. <br><br><div class="codetitle"> <span><a style="CURSOR: pointer" data="93027" class="copybut" id="copybut93027" onclick="doCopy('code93027')"><u>Copy code</u></a></span> The code is as follows:</div> <div class="codebody" id="code93027"> <br><script defer="defer" src ="Jquery/DatePicker/WdatePicker.js" type="text/javascript"></script>


Reference:

Defer attribute in Script
If you are someone who is more concerned about system performance, I think you will be interested in the defer attribute in the Script script.
The defer attribute in script is false by default. According to the description in the DHTML Programming Guide, the Defer attribute is written like this:
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.
In other words: if you add the defer attribute when writing a script, then the browser does not have to process it immediately when downloading the script, but continues to download and parse the page, which will Improve download performance.
There are many such situations. For example, if you define a lot of JavaScript variables, or write a lot of scripts in the reference file (.inc) that need to be processed, you might as well add the defer attribute to these scripts, which will definitely help improve performance.
For example:

Because defer The attribute defaults to false, so here
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template