Solve the problem of "Introducing JS file IE6 Error"

Source: Internet
Author: User
Problem Description: The page introduces a JS file, which defines the function or object, and then calls the function or object in the page, IE6 the "syntax error" or "Missing object". In ie6+ or IE7 it works fine.             Problem Analysis: This object in the introduction of the JS file is present, because in ie6+ above the browser can run normally. The problem is file encoding, if the JS file encoding and the current page encoding inconsistent, it may lead to IE6 in the page can not be normal to obtain and parse the contents of JS file, in IE6, the default introduction of the file and page encoding is consistent. In ie6+ above browser, the general browser will automatically identify each external file encoding and parsing;             Problem Resolution:      One: the introduction of JS file with CharSet attributes, to maintain consistent with the page code;      II: Modify the introduction of file encoding format;      Three: Create a new file format in line with the page encoding format, copy paste content;      (personal advice for the third method, but it is recommended to add the CharSet property when JS is imported.) )              discovery problem:      Due to reload system, post project found JS error: report grammatical errors and missing objects. Depressed      Before the system is IE7, after reloading the system for IE6. Just started to think that the browser version of the problem, the page import JS inside there are IE6 incompatible code. So the last JS line of comments out, when the last JS files are all deleted, there are errors above. ------Super Depressed      before the code is OK, how to reload a system is bad ~ finally find the previous project released, in the IE6 without errors, the code exactly the same. ------------don't know if I can use the word "depressed".      Thought for a long time, thinking about coding problems. The previous project was encoded as GB2312, now the project is changed to UTF-8      <script language= "JavaScript" type= "Text/javas"Cript "src=" xx.js "  charset=" UTF-8 "> </script>      Plus did not work, and then to JS the encoding format to UTF-8 operation is not. Finally a new JS file encoding format changed to Utf-8, release OK.      Halo, General Coding Modification (1). Increase CharSet. (2). Modify the file encoding format. Also to Tomcat under the view has also been modified. Don't know what's going on.      may want to delete all in the release bar ... But the problem is solved ~ if you do not reload the system, you can not find this small bug     ----Write down to prevent this error from happening.

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.