Using console.log() with firebug works locally, but not when published to my live site

后端 未结 3 1827
梦毁少年i
梦毁少年i 2021-01-06 19:43

I\'m using the:

console.log()

method to log messages to firefox (3.6.6)/firebug while working on my webapp. When I view the app locally, it w

3条回答
  •  清酒与你
    2021-01-06 20:32

    The console object is not defined in FF unless Firebug is open.

    In Chrome it's always defined.

    One way to handle it is to define it if it is not defined:

    if(!window.console) console = {log: function() {}};
    

提交回复
热议问题