How does javascript determine whether firebug is enabled?

Source: Internet
Author: User
How to use javascript to determine whether firebug is enabled this article describes how to use javascript to determine whether firebug is enabled. We will share this with you for your reference. The details are as follows:

Anyone who often uses Firefox + Firebug to debug JavaScript knows that once firebug is enabled, page js running will be significantly slower.

Can the page javascript determine whether the current Firebug is enabled?

The answer is yes.

Firebug has updated many versions. In the impression, an old version can be determined by detecting console. firebug, but it is no longer valid.

In recent versions of firebug, you can use the console. table () method to determine that the returned value is a string "_ firebugIgnore"

The complete demo code is as follows:

Script function check_firebug () {if (window. console & (console. firebug | console. table &/firebug/I. test (console. table () {alert ('firebug is running ');} else {alert ('no Firebug detected');} script

This method also has a disadvantage. After the firebug is disabled, the console. table () still returns "_ firebugIgnore", and the page needs to be refreshed. But in most cases, it is enough.

The console. table () method is used to view variables or objects in a table. input parameters are the variables or objects to be viewed. This "_ firebugIgnore" is returned without passing the parameter. Isn't it an egg?

Example (run in firebug console ):

arr=[["aaaa",1,2,3],["bbbb",4,5,6]];console.table(arr);

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.