天天看點

利用js去除無限debugger

極簡桌面F12後悔無限debug,還會一直增加記憶體,導緻卡機

将下面的代碼放到開發者選項的Console裡面,回車,就可以終止debug了

//去除無限debugger
Function.prototype.__constructor_back = Function.prototype.constructor ;
Function.prototype.constructor = function() {
    if(arguments && typeof arguments[0]==='string'){
        //alert("new function: "+ arguments[0]);
        if( "debugger" === arguments[0]){
            //arguments[0]="consoLe.Log(\"anti debugger\");";
            //arguments[0]=";";
            return
    }
    }
    return Function.prototype.__constructor_back.apply(this,arguments);
}