Js about console in the compatibility of IE under the problem

Source: Internet
Author: User

In the process of developing code, programmers use the console as a means of debugging code procedures.

Publish to a test production environment and discover that IE8 has a load error. Use the developer tools to debug and find that you can bypass the problem.

Search through the web and make corrections in the project.

The following measures may be effective:

1, remove the console code (because it is debugging code, does not affect the use of online).

2, in the Basic JS script file to add:

1(function() {2     varmethod;3     varNoOp =function () {};4     varMethods = [5' Assert ', ' clear ', ' count ', ' Debug ', ' dir ', ' dirxml ', ' ERROR ',6' Exception ', ' group ', ' groupcollapsed ', ' groupend ', ' info ', ' log ',7' Marktimeline ', ' profile ', ' profileend ', ' table ', ' time ', ' timeend ',8' Timeline ', ' timelineend ', ' timeStamp ', ' trace ', ' warn '9     ];Ten     varLength =methods.length; One     varConsole = (Window.console = Window.console | | {}); A  -      while(length--) { -METHOD =Methods[length]; the  -         //Only stub undefined methods. -         if(!Console[method]) { -Console[method] =NoOp; +         } -     } +}());

Js about console in the compatibility of IE under the problem

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.