By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,712 Members | 2,111 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,712 IT Pros & Developers. It's quick & easy.

Faq on JS Errors

P: n/a
MC
Thats a nice FAQ but it doesn't really help too much. How would you capture
js errors after the page has loaded? If I knew that, I could send them back
to a server via ajax and record them, so they could be fixed.

Any ideas on that?
MC
Jul 29 '08 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On Jul 29, 9:09 am, "MC" <mica[removethis]@aisus.comwrote:
Thats a nice FAQ
Which FAQ?
but it doesn't really help too much. How would you capture
js errors after the page has loaded? If I knew that, I could send them back
to a server via ajax and record them, so they could be fixed.
This is not a frequent question.
Any ideas on that?
try-catch

Peter
Jul 29 '08 #2

P: n/a
MC

"Peter Michaux" <pe**********@gmail.comwrote in message
news:1d**********************************@q28g2000 prh.googlegroups.com...
On Jul 29, 9:09 am, "MC" <mica[removethis]@aisus.comwrote:
>Thats a nice FAQ

Which FAQ?
>but it doesn't really help too much. How would you capture
js errors after the page has loaded? If I knew that, I could send them
back
to a server via ajax and record them, so they could be fixed.

This is not a frequent question.
>Any ideas on that?

try-catch

Peter
So there is no error stack that I can access?
Something like document.error[0]....?
MC
Jul 29 '08 #3

P: n/a
On Jul 29, 10:29 am, "MC" <mica[removethis]@aisus.comwrote:
"Peter Michaux" <petermich...@gmail.comwrote in message

news:1d**********************************@q28g2000 prh.googlegroups.com...
On Jul 29, 9:09 am, "MC" <mica[removethis]@aisus.comwrote:
Thats a nice FAQ
Which FAQ?
but it doesn't really help too much. How would you capture
js errors after the page has loaded? If I knew that, I could send them
back
to a server via ajax and record them, so they could be fixed.
This is not a frequent question.
Any ideas on that?
try-catch
Peter

So there is no error stack that I can access?
Something like document.error[0]....?
There is an (Java) error stack available in Rhino.

http://www.mozilla.org/rhino/

Peter
Jul 29 '08 #4

P: n/a
On Jul 30, 12:09*am, "MC" <mica[removethis]@aisus.comwrote:
Thats a nice FAQ but it doesn't really help too much. How would you capture
js errors after the page has loaded? If I knew that, I could send them back
to a server via ajax and record them, so they could be fixed.
Try handling the error event:

window.onerror = function (err,url,lineNumber) {
sendByAjax(err+", at:"+url+", line:"+lineNumber);
}

see:

http://developer.mozilla.org/en/docs/DOM:window.onerror
Jul 29 '08 #5

P: n/a
slebetman wrote:
On Jul 30, 12:09 am, "MC" <mica[removethis]@aisus.comwrote:
>Thats a nice FAQ but it doesn't really help too much. How would you capture
js errors after the page has loaded? If I knew that, I could send them back
to a server via ajax and record them, so they could be fixed.

Try handling the error event:

window.onerror = function (err,url,lineNumber) {
sendByAjax(err+", at:"+url+", line:"+lineNumber);
}

see:

http://developer.mozilla.org/en/docs/DOM:window.onerror
The onerror event handler is proprietary and unreliable. Therefore it
should only serve as a fallback for exception handling.

It should also be noted that syntax errors cannot be handled either way.
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Jul 30 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.