9

I have a script to handle window.onerrors and push it to my server. I see some "Error Loading Script" errors that happen only in Firefox.

I searched around and people were ignoring "Error loading Script" errors. For example

  1. Cryptic "Script Error." reported in Javascript in Chrome and Firefox
  2. Firefox: "Error loading script"

Can these errors be safely ignored like the above? Or should I ignore only in Firefox?

Community
  • 1
  • 1
rampr
  • 1,877
  • 4
  • 21
  • 36
  • 2
    What do you mean by "safely ignored"? I would say that in general, an error loading a script is a problem with your code (e.g. URL for script is incorrect, perhaps it is a computed URL and the code to compute it is wrong, etc) and you should log these, but if there is some valid reason why sometimes the script would not load in some circumstances, then perhaps you can ignore them. I'm also not sure what you mean by "ignore only in Firefox" -- are you saying that the scripts load correctly in other browsers? – leftclickben Oct 17 '14 at 05:30
  • 1
    Is the URL to the script over HTTPS? I've seen this error happen due to SSL certificate issues. – Greg Burghardt Oct 29 '14 at 15:42
  • 2
    You're not provided enough information to answer your question. This could be caused by cross-domain security limitations, a problem with your code, or a portion of one of the included scripts interrupting script load. That means that it *may* be okay to ignore **if and only if** you know what is causing the error, and you know that resulting behavior will not impact your work. In general however, it is bad practice not to address errors of an unknown cause. – Tony Chiboucas Oct 29 '14 at 21:12
  • possible duplicate of [Firefox: "Error loading script"](http://stackoverflow.com/questions/1087518/firefox-error-loading-script) –  Nov 14 '14 at 11:21
  • If you've got an error that you don't understand, then ignoring it is probably going to give you bigger problems further down the line. But ultimately, it depends how important the script that is failing to load is to your site -- if it's a key part of your functionality, then things are going to break without it. If it's something like a third party advertising or tracking library that doesn't interact with anything else then you may be safe ignoring it, although of course you'd lose the benefits of any advertising or tracking that it should be doing for you. – Spudley Aug 08 '15 at 20:25

2 Answers2

0

If by ignoring you mean hiding, yes, probably.

Just quote you code like this:

try {

    // put code that produce error

}
catch( error ){

    // console.log(error);

};

Hiding error is probably not the better solution for your problem...

Jordan
  • 3,776
  • 3
  • 22
  • 28
0

"Error loading script" is not reported via window.onerror in Firefox 14+: MDN, Bugzilla.

Nickolay
  • 31,095
  • 13
  • 107
  • 185