Home > Web Front-end > JS Tutorial > body text

JS - javascript fault tolerance handling code

高洛峰
Release: 2016-11-17 11:54:58
Original
1863 people have browsed it

1. Phenomenon description
When an error occurs in the execution of the javascript code on the page, the browser will display an error message.
JS - javascript fault tolerance handling code

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;}
Copy after login

Note: Doing this just ignores the error message. If an error occurs in js, the execution of the following js will still be blocked.


Related labels:
js
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template