开发者

jQuery BeautyOfCode Plugin remove alerts?

Is possible to remove alert() from the plug开发者_高级运维in when brushes are not founded?


Per my comment above, diverting alerts to console:

if (typeof(console) !== "undefined") {
  window.alert = function(content) {
    try {
      window.console.log(content); /* send alerts to console.log if available. */
    } catch(e) {}
  }
}

Works great for "old-school" debugging, too. You can safely use "alert" instead of "console.log" and then when you test your application in a browser that doesn't have console you can still see your debugging output.

Note: in such browsers, alert will still appear. I presume this is a good thing, because the user will need to be told that something has failed. If this is NOT a good thing, because you want to avoid the warnings altogether, the above code will not necessarily help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜