- Automatic feedback on JavaScript error
- Logging JavaScript-Errors on Server
How would I go abou
I use this function in all my projects:
window.onerror = function(m,u,l){
jQuery.post("ajax/js_error_log.php",
{ msg: m,
url: u,
line: l,
window: window.location.href });
return true};
Make sure it is the very first javascript the browser receives or at least precedes any potentially error-causing code. Requires jQuery of course, but you could code ajax functions in pure javascript if you wanted to.
Please note: this will not help you if you have a syntax error. All javascript instantly dies if there is a syntax error.