How to detect if FireBug is active in FireFox 3?

154 views
Skip to first unread message

BigKat

unread,
Aug 6, 2008, 9:38:28 PM8/6/08
to Firebug
In my web application, some of my ajax / javascript has undesired
behavior when firebug is enabled. So I have javaScript that detects
if firebug is enabled.. Basically checking for window.__firebug__ to
be present.

If it is present I put up a warning message to the user. This works
great for Firefox 2, but now that Firefox 3 is out the check I am
using no longer is valid. Does anyone know of what I can be checking
for in Firefox 3 to see if Firebug is enabled?

Thanks in advance for any suggestions.

John J Barton

unread,
Aug 7, 2008, 12:29:24 AM8/7/08
to Firebug
I think your better strategy is help us fix the undesired behavior. If
the user has the console enabled, you can detect it, but I doubt that
has anything to do with your problems. More like it is script or net,
which you can't detect.

BigKat

unread,
Aug 7, 2008, 11:06:07 AM8/7/08
to Firebug
I agree and I would like not to be able to show this message and have
my application work
the same when firebug is enabled as it is when disabled. But for the
time being I really need to
put up a warning message.

So can you please let me know how I can detect if the console is
enabled in FireFox 3? Once I at least have
that check in there I plan on digging into what the real issue is.

Thanks.
> > Thanks in advance for any suggestions.- Hide quoted text -
>
> - Show quoted text -

John J Barton

unread,
Aug 7, 2008, 4:07:23 PM8/7/08
to Firebug
When the console is active, Firebug allows code to use window.console
to write stuff in to Firebug. So I believe you can test for
window.console or perhaps var c = window.console; if (c)...

duniyadnd

unread,
Aug 7, 2008, 3:18:55 PM8/7/08
to Firebug
It doesn't work because it is no longer a whole number (e.g. 1.2b7)

<script>
var fire = String(window.console.firebug);
if ( fire.substr(0,1) > 0 ) {
// found you
} else {
// carry on
}
</script>

John J Barton

unread,
Aug 8, 2008, 11:36:34 AM8/8/08
to Firebug
I don't understand what you are saying. What does not work and what
does the numerical interpretation of the string "1.2b7" have to do
with detecting Firebug?

duniyadnd

unread,
Aug 10, 2008, 6:09:08 PM8/10/08
to Firebug
Sorry, I replied before your message even showed up on my end - so it
had nothing to do with your message. I initially had

if ( window.console.firebug > 0 ) {/* xyz */}

and it didn't work since Firefox 3, so I figured it had to match the
first character of the string.

John J Barton

unread,
Aug 11, 2008, 12:43:20 AM8/11/08
to Firebug
window.console is available 1) If Firebug is active, 2) If the Console
is active, and 3) if the window getter function has run. You might
need something like
if (window.console && window.console.firebug) I don't know.

Immeëmosol

unread,
Sep 27, 2008, 11:32:58 AM9/27/08
to Firebug
It didn't work here. (
Ubuntu 8.04 i.e. Hardy Heron
FireFox 3. 0.3(a.t.m.)
FireBug installed from the Ubuntu repostiories
)

So I fiddled somewhat:
if (window.console){
for (index in window.console){
console.log(index + ' >' + window.console[index]);
}
}

This gives me everything of window.console if I am not mistaken.

Long story short, no window.console.firebug || console.firebug
.
So I decided to do a check for something else, namely firebugVersion()
.
Which give me this script:

if (!window.console || !window.console.firebugVersion)
{
var names = ["log", "debug", "info", "warn", "error",
"assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd",
"count", "trace", "profile", "profileEnd"];
window.console = {};
for (i in names)
{
window.console[names[i]] = function() {};
}
}

This works for me,
not giving me errors in Opera
and giving me console-stuff in firefox.

On Aug 11, 6:43 am, John J Barton <johnjbar...@johnjbarton.com> wrote:
> window.console is available 1)IfFirebugisactive, 2)Ifthe Console
> isactive, and 3)ifthe window getter function has run. You might
> need something likeif(window.console && window.console.firebug) I don't know.
>
> On Aug 10, 3:09 pm, duniyadnd <umangb...@gmail.com> wrote:
>
> > Sorry, I replied before your message even showed up on my end - so it
> > had nothing to do with your message. I initially had
>
> >if ( window.console.firebug> 0 ) {/* xyz */}
>
> > and it didn't work since Firefox 3, so I figured it had to match the
> > first character of the string.
>
> > On Aug 8, 11:36 am, John J Barton <johnjbar...@johnjbarton.com> wrote:
>
> > > I don't understand what you are saying. What does not work and what
> > > does the numerical interpretation of the string "1.2b7" have to do
> > > with detectingFirebug?
>
> > > On Aug 7, 12:18 pm, duniyadnd <umangb...@gmail.com> wrote:
>
> > > > It doesn't work because it is no longer a whole number (e.g. 1.2b7)
>
> > > > <script>
> > > > var fire = String(window.console.firebug);
> > > >if( fire.substr(0,1) > 0 ) {
> > > > // found you} else {
> > > > // carry on
> > > > }
>
> > > > </script>
>
> > > > On Aug 7, 11:06 am, BigKat <aaronsah...@yahoo.com> wrote:
>
> > > > > I agree and I would like not to be able to show this message and have
> > > > > my application work
> > > > > the same whenfirebugis enabled as it is when disabled.   But for the
> > > > > time being I really need to
> > > > > put up a warning message.
>
> > > > > So can you please let me know how I candetectifthe console is
> > > > > enabled in FireFox 3?   Once I at least have
> > > > > that check in there I plan on digging into what the real issue is.
>
> > > > > Thanks.
>
> > > > > On Aug 6, 11:29 pm, John J Barton <johnjbar...@johnjbarton.com> wrote:
>
> > > > > > I think your better strategy is help us fix the undesired behavior.If
> > > > > > the user has the console enabled, you candetectit, but I doubt that
> > > > > > has anything to do with your problems. More like it is script or net,
> > > > > > which you can'tdetect.
>
> > > > > > On Aug 6, 6:38 pm, BigKat <aaronsah...@yahoo.com> wrote:
>
> > > > > > > In my web application, some of my ajax / javascript has undesired
> > > > > > > behavior whenfirebugis enabled.   So I have javaScript that detects
> > > > > > >iffirebugis enabled.. Basically checking for window.__firebug__ to
> > > > > > > be present.
>
> > > > > > >Ifit is present I put up a warning message to the user.   This works
> > > > > > > great for Firefox 2, but now that Firefox 3 is out the check I am
> > > > > > > using no longer is valid.   Does anyone know of what I can be checking
> > > > > > > for in Firefox 3 to seeifFirebugis enabled?
Reply all
Reply to author
Forward
0 new messages