'Console is not defined' troubles

69 views
Skip to first unread message

Dave

unread,
Nov 14, 2009, 6:37:53 AM11/14/09
to Firebug
I've recently noticed the console not working. I really don't know why
it's not, I haven't mess with any of the settings. I haven't used
Firebug in awhile, but it has happened ever since I've updated. Any
idea if I'm doing something wrong or if it's wrong?

It always says 'console is not defined' when I use console.log()

Please help.

John J Barton

unread,
Nov 14, 2009, 1:21:52 PM11/14/09
to Firebug
Well you didn't give enough information for us to help you. Perhaps
you installed a Firefox extension or changed an option since it
worked?

You can try two things:
1) Reset all Firebug options. http://getfirebug.com/wiki/index.php/FAQ#Resetting_All_Options
2) Install Firebug 1.5b3 in a new Firefox profile.
http://getfirebug.com/wiki/index.php/FAQ#Installing_in_a_clean_Profile

jjb

stuartski

unread,
Nov 19, 2009, 8:58:10 AM11/19/09
to Firebug
I often get this message when i try to use firebug. The way i often
get round it is to type in "console.debug(' ')" into the script
section and run it. I do this before the console.log or console.debug
gets called. if i then get a message saying its doesn't work i
refresh the browser

On Nov 14, 6:21 pm, John J Barton <johnjbar...@johnjbarton.com> wrote:
> On Nov 14, 3:37 am, Dave <buttonst...@gmail.com> wrote:
>
> > I've recently noticed the console not working. I really don't know why
> > it's not, I haven't mess with any of the settings. I haven't used
> > Firebug in awhile, but it has happened ever since I've updated. Any
> > idea if I'm doing something wrong or if it's wrong?
>
> > It always says 'console is not defined' when I use console.log()
>
> > Please help.
>
> Well you didn't give enough information for us to help you. Perhaps
> you installed a Firefox extension or changed an option since it
> worked?
>
> You can try two things:
>   1) Reset all Firebug options.http://getfirebug.com/wiki/index.php/FAQ#Resetting_All_Options

kamenjar

unread,
Nov 24, 2009, 3:32:58 PM11/24/09
to Firebug
<html>
<body onload="javascript:onLoad();">
<script>
function onTimeout() {
location.reload(true);
}
function onLoad() {
if (console && typeof console.log == "function") console.log("Hello
world");
// switch to a different tab then allow the timer to expire.
// it will die with javascript error here.
// Next statement will never execute and the page will stop
reloading! -- BUG

setTimeout(onTimeout, 3000);
}
</script>
</html>

John J Barton

unread,
Nov 25, 2009, 11:01:04 AM11/25/09
to Firebug
https://fbug.googlecode.com/svn/tests/issues/ConsoleNotDefined.html

Firefox does not fire 'onLocationChange' for the hidden tab, so
Firebug does not know that the page changed and thus does not include
the console for it.

I'm checking with Firefox team, but my guess is that we can't fix this
for Firebug 1.5. We need either to reimplement the console (schedule
for Firebug 1.7) or get a different way to know about the page change
(Firefox 3.7?).

jjb

kamenjar

unread,
Nov 25, 2009, 12:13:16 PM11/25/09
to Firebug
I understand that there may be technical issues that revolve around
the browser, but the fact that this breaks all my code that uses
console and no way for me to protect against it is a problem. I mean,
console is not defined -- fine, but how should I write my code so it
doesn't error out? I thought that if(console) was safe enough check.

John J Barton

unread,
Nov 25, 2009, 12:36:12 PM11/25/09
to Firebug
Oh, then check for 'window.console':
if (window.console && typeof console.log == "function")
console.log("Hello world");
Sadly the expression
if (console)
fails at compile time.

jjb

John J Barton

unread,
Nov 25, 2009, 7:55:56 PM11/25/09
to Firebug
Ok I learned from the Firefox team that we can probably solve the
problem of the console not being injected by replacing our
addProgressListener with a addTabsProgressListener. Maybe I'll
remember this...

jjb

On Nov 25, 9:13 am, kamenjar <nikol...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages