首页 > 代码库 > js 获取控制台的错误信息

js 获取控制台的错误信息

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>Document</title></head><script type="text/javascript">onerror = function(msg,url,l){    var txt="";    txt+= msg + "\n";    txt+= "URL: " + url + "\n";    txt+= "Line: " + l + "\n\n";    alert(txt);}</script></head><body><input type="button" value="View message" onclick="test()" /></body></html>

 

js 获取控制台的错误信息