is there a way in which we can get the list of errors in the console using pure javascript or jquery or any other client side script?
console.error("params")
just creates error, but I am not able to access the list of errors in console with it
There's no build in function in javascript to get a list of all errors but you may use window.onerror to append the error message to an array each time you get one.
var myErrors = [];
startTrackingErrors = true;
window.onerror = function (errorMessage, url, lineNumber) {
if (!startTrackingErrors) { return false; }
myErrors.push({
errorMessage : errorMessage,
url : url,
lineNumber : lineNumber
});
return true;
};
Here's a working demo (with error :P)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.