1

I am using a window.onerror=function(msg, url, linenumber) to send myself an email when a javascript error occurs. When I use my webpages (IE, FF, CHRM, ect) I do not receive any errors. However I am getting all kinds of errors emailed to me from other users that I cannot duplicate. I am probably getting an error happening on 1% of the users visiting the website so 1/100 page loads I get an error. Here are some:

What I don't understand is the website 99% of the time is running without any errors and I can't seem to get an error to happen for me on any browser I use. I am also tracking what browsers the users are using who send these errors and it's random, all sorts of browsers and they are all newer FF, IE versions mainly.

How do you stop syntax errors on external code (but they work most of the time)...? How come google and thawte scripts fail to load some people so often but never happens to me, is there a way to have a fallback to this? The datepicker one, I can only assume its error out because jquery UI failed to load because jquery loads (otherwise it wouldn't get called inside a document ready call) but I even have a localhost jquery UI script fallback include and it still happens..

Does anyone have a suggestion for me to help me further debug/fix these problems. The thing is, the website gets a lot of hits I am getting about 1 error emailed to me every minute (and it's not the same user causing each error). If you have any suggestions let me know (remember the code and website work fine 99% of the time so I don't think its a syntax problem on my end anywhere).

Thanks for your time.

2
  • I know some guys from Iran have hard time with google's servers, maybe something related to user's country. Commented Jan 14, 2013 at 21:28
  • Oh everyone on the site is from California. Thanks Commented Jan 14, 2013 at 21:30

2 Answers 2

1

How do you stop syntax errors on external code (but they work most of the time)...?

You can't really. Without a more detailed message investigation is quite impossible. Notice that sysntax errors might be caused by something else as well, their origin might not be in the external script. I doubt Google Analyticts serves invalid scripts.

How come google and thawte scripts fail to load some people so often but never happens to me

They might use adblockers or similiar against those. Not everyone wants his web usage logged by google. Also, some proxies might ignore/block them, like intranet firewalls.

is there a way to have a fallback to this?

You could try serving them from your own domain as a proxy. Or just ignore them, I don't think your app really needs a fallback for those.

The datepicker one, I can only assume its error out because jquery UI failed to load as jquery still loads

Yes, that sounds likely. Or it just didn't load before it was called.

but I even have a localhost jquery UI script fallback include and it still happens..

Localhost? I guess you mean a copy on your server. Still, it depends on the details how the script and its fallback version are loaded.

Does anyone have a suggestion for me to help me further debug/fix these problems.

A stack trace would help a lot to locate the user's action that caused the error.

Sign up to request clarification or add additional context in comments.

Comments

1

Most of the errors on the list are caused by errors in browser extensions.

If you really want to log JavaScript errors, it is best you also log the stack trace if available. I also log details about functions that execute and the arguments sent to it. When the error is caught I cut X amount of stuff from the stack I built and send that up as well.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.