To keep a server-side log of JavaScript errors
$(window).error(function(msg, url, line){ jQuery.post("error_log.php", { msg: msg, url: url, line: line }); });