When document. Write contains a script tag

Source: Internet
Author: User

In JavaScript, document. the Write function can write content to the document. When there is a <SCRIPT> label in the written content, it will execute the JS script, which has always been the same in the past, however, when debugging a webpage script today, we found that this is not the case.

When <SCRIPT> is an external link script, this external link script will not be executed immediately, but will not be executed until the <SCRIPT> label of document. Write is executed.

In this case, both Firefox and chrome will encounter the <SCRIPT> tag write function that will stop parsing the document and return it, IE8 does not execute the script when it encounters an external link <SCRIPT> tag, but continues to parse the document.

For the moment, follow the IE8 method.

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.