views:

76

answers:

2

Hi,

Does anybody have a way to detect Firebug opening and closing.

I know you can do the following:

if (window.console && window.console.firebug) {
  //Firebug is enabled
}

but this only detects the firebug console on page load. What I want to do is on a page where firebug is not open, detect the opening of the firebug console.

I've tried the following, but with no luck

setInterval(function(){
  if(window.console && window.console.firebug){
    ...
  else
    ...
}, 1000);

Any help greatly appreciated.

Matt

+1  A: 

Simply.. You cant. The firebug window not just an another couple of div element on your page.

BigbangO
+1  A: 

The Firebug window.console object is created just before the first Javascript in the page is executed but only if Firebug is active for the page before the first JS and if the user has the Firebug Console panel enabled.

In other words, from within the page you can only detect if the Console is enabled. But for your purposes that should be enough.

We should delete the console property if a user turns Firebug off for a page. I don't know if we actually do that.

johnjbarton
Hi John. Your last sentence is probably the most poinient one. Yes, I can check window.console on load, but it doesn't look like window.console is updated (either created when Firebug is opened, or removed when closed) which is what I am trying to detect. So am I right then that there is no way to detect, given a page with firebug closed, when firebug is opened? and vice versa? Other than refreshing the page.
Matt Brailsford