Domanda

Is possible to remove alert() from the plugin when brushes are not founded?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top