Created
January 9, 2019 14:05
-
-
Save smadey/d1e9d5d2393a0a11fdaba737ace60288 to your computer and use it in GitHub Desktop.
错误调试
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onerror = function (msg, url, lineNo, columnNo, error) { | |
var string = msg.toLowerCase(); | |
var substring = "script error"; | |
if (string.indexOf(substring) > -1){ | |
alert('Script Error: See Browser Console for Detail'); | |
} else { | |
var message = [ | |
'Message: ' + msg, | |
'URL: ' + url, | |
'Line: ' + lineNo, | |
'Column: ' + columnNo, | |
'Error object: ' + JSON.stringify(error) | |
].join(' - '); | |
alert(message); | |
} | |
return false; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment