When you access the webpage in Internet Explorer, you receive the "Operation aborted" error message.

Source: Internet
Author: User

Document. body. appendChild () causes the site to fail to load normally. The following message is displayed: Internet Explorer cannot open the Internet site XXX ?? The operation has been terminated.

Generally, this problem only occurs in IE. But not in firefox, because Firefox's body exists before the body tag is fully read by the browser, and IE's body must exist after the body tag is fully read by the browser. in the page loading process (before the body ends: </body>), use document. body. appendChild () will generate such an error!
Solution:
1. Call appendChild () on a loaded object to create an object.
2. After the page is loaded, execute the document. body. appendChild () action to put it behind </body>.
3. Determine document in the appendChild or innerHTML operation. readyState = "complete". If not, use window. setTimeout () to delay the document. body. appendChild. However, this attribute is only valid for ie and opeara. The document of ff does not have the readyState attribute and is always undefined.

4. Use the defer attribute in the script. It is intended to execute the script after the page is loaded, so that the object cannot be found. Defer does not consider whether all external files have been downloaded, but determines whether the current page has been fully loaded. In addition, the document. write method cannot be written in a code block with a defer label.
5. An error occurs when ajax is used. Solution: Determine document. readyState = "complete" in the appendChild or innerHTML operation. If no, setTimeout will be performed several seconds later.

 

<script type="text/javascript">
var tar=function()
{
    var chd=window.top.document.createElement("div");
    window.top.document.body.appendChild(chd);
}
if(document.readyState!="complete")
      window.setTimeout(tar,10);
else
      tar();
</script>

More detailed information: http://support.microsoft.com/kb/927917

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.