Home > Article > Web Front-end > JS - javascript fault tolerance handling code
1. Phenomenon description
When an error occurs in the execution of the javascript code on the page, the browser will display an error message.
2. Shield js errors
Sometimes after our project goes online, we need to let the browser ignore js errors. You can add the following code in the script tag, then the page will no longer display error prompts.
window.onerror = function(){return true;}
Note: Doing this just ignores the error message. If an error occurs in js, the execution of the following js will still be blocked.