redirect Javascript syntax errors and console.log to somewhere else
问题 I'm trying to send whatever would normally appear in the javascript console to my own custom functions. I've tried the following window.console.error = window.console.debug = window.console.log window.console.log=mylog; function mylog(msg){ //send it somewhere just using alert as an example alert("log="+msg); } console.log("yo"); var x=y;//a syntax error Using the code above I only see the following alert "yo" In the console log I see "x is not defined" How do I redirect the syntax errors?