ignore firebug console when not installed

后端 未结 9 1233
旧时难觅i
旧时难觅i 2021-02-02 04:15

I use Firebug\'s console.log() for debugging my website. If I try viewing my website in browsers without Firebug then I get a console is not defined er

9条回答
  •  臣服心动
    2021-02-02 04:39

    Honestly, I'd use that. It not only covers console.log(), but also every other console method, and in a decently short number of lines. The fact that it was first used in the Yahoo media player seems to suggest that it works excellently cross-browser, as well.

    That bit of code is your best bet, is actually decently elegant, and should work in most every case. As long as you comment above the snippet just what it is for (so as not to confuse future developers), you should be fine.

提交回复
热议问题