Capture contents of Firefox/IE error console through code?
Asked Answered
K

1

4

Is it possible to capture the contents of either the Firefox or IE javascript error console? I'm thinking adding a feature where when a user clicks the 'Report A Bug' link on my site, it also sends along the contents of the console, incase there are any useful errors in it. That way I don't have to tell them to manually open it and copy & paste the contents to me.

Kriss answered 7/10, 2009 at 22:55 Comment(1)
See "Capturing javascript console.log?" #11403607Kirman
L
4

you can hook into the window.onerror event and send a request to your server with the details.

Just be aware that it won't work on all browsers, and the details of the error will vary by browser. e.g. IE may return the oh so helpful: "Object does not support property or method" and you're left wondering which object, what property?... ;-)

Levins answered 7/10, 2009 at 23:0 Comment(1)
This looks good, here's a page I found with an example: javascriptkit.com/javatutors/error3.shtmlKriss

© 2022 - 2024 — McMap. All rights reserved.