Ignore javascript syntax errors in a page and continue executing the script

前端 未结 11 850
日久生厌
日久生厌 2020-12-02 18:21

I develop plugins for WordPress. It uses some jquery in the user side (themes) as a jquery plugin. The problem is, when there is an javascript error with other plugins made

11条回答
  •  有刺的猬
    2020-12-02 18:37

    If you page is running. Use:

    $(window).error(function(e){
            e.preventDefault();
    });  // IGNORE ALL ERROR JQUERY!
    

    or use:

    window.onerror = function(){
       return true;
    }  // IGNORE ALL ERROR JAVASCRIPT!
    

提交回复
热议问题