Javascript checks whether firebug is enabled

Source: Internet
Author: User
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 .... SyntaxHighli

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:
[Html]
1. 
2. script
3. function check_firebug (){
4. if (window. console & (console. firebug | console. table &/firebug/I. test (console. table ()))){
5. alert ('firebug is running ');
6.} else {
7. alert ('no Firebug detected ');
8.

}
9 .}
10. 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 ):
[Javascript]
1. arr = [["aaaa", 3], ["bbbb", 6];
2. console. table (arr );
For more advanced usage of console. table (), see http://www.softwareishard.com/blog/firebug/tabular-logs-in-firebug /.

 


From unintentional Columns

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.