Well, just for reference:
    window.console = {};
    window.console.info = {};
    window.console.log = {};
    window.console.warn = {};
    window.console.error = {};
won't prevent console.log from throwing that error, because literally,
console.log equals '{}' or an object, not a function.  So when calls
like console.log("hey!") happen, they can't execute because it's only
an simple object.  If you change it to window.console.log = function()
{}, it will prevent that problem.  I suggest:

if (window['loadFirebugConsole']) {
    window.loadFirebugConsole();
} else if (!window['console']) {

    window.console = {};
    window.console.info =
    window.console.log =
    window.console.warn =
    window.console.error = function(){}

}

for an easy, cheap solution (e.g. only one anonymous function gets
created :-)).

On Apr 15, 9:33 am, MorningZ <[email protected]> wrote:
> I'm tired of sporatically running across this error
>
> *Most* of the time Firebug's console works as advertised, but once in
> a while it starts blowing up with "console.log is not a function",
> preventing my script from working/completing
>
> I've seen lots of previous talk about having to "load" the console,
> and I even saw some sample code that is:
>
> if (window['loadFirebugConsole']) {
>     window.loadFirebugConsole();} else if (!window['console']) {
>
>     window.console = {};
>     window.console.info = {};
>     window.console.log = {};
>     window.console.warn = {};
>     window.console.error = {};
>
> }
>
> this is supposed to prevent this error from happening (like if i was
> viewing the page on IE7 or Chrome)
>
> but alas, even with that code in place I still, and again just once in
> a while, run into a situation where this error is thrown
>
> Closing Firefox and re-opening solves the issue, but that's not an
> acceptable answer to give users of the system

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Firebug" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/firebug?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to