JS catches global exceptions



Just override the window.onerror method

window.onerror = handleError
function handleError(msg,url,l)
{
  var txt="There was an error on this page.\n\n"
    txt+="Error: " + msg + "\n"
    txt+="URL: " + url + "\n"
    txt+="Line: " + l + "\n\n"
    txt+="Click OK to continue.\n\n"
    alert(txt)
    return true
} //If the return value is false, display an error message in the console (JavaScript console). Otherwise it will not
Fundebug monitors front-end JavaScript errors in real time by extending the onerror event . After a lot of compatibility debugging, Fundebug's JavaScript monitoring plug-in has been able to automatically capture errors in various mainstream browsers, and can obtain the most comprehensive error information, helping developers to better Quick Debug. And for the IE browser, which is not very popular recently, we also fully support it, from IE 6 to IE 11 .

you may be interested in

  1. Detailed explanation of 10 major JavaScript errors from 1000+ project data analysis
  2. Prompt "username or password is incorrect" is bad
  3. Debug front-end HTML/CSS

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325603394&siteId=291194637