-
-
Save bjrmatos/1dfd15059b5a9969a6a0 to your computer and use it in GitHub Desktop.
Disable JS execution in console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Disable javascript execution from console | |
// http://kspace.in/blog/2013/02/22/disable-javascript-execution-from-console/ | |
var _z = console; | |
Object.defineProperty( window, "console", { | |
get : function(){ | |
if( _z._commandLineAPI ){ | |
throw "Sorry, Can't exceute scripts!"; | |
} | |
return _z; | |
}, | |
set : function(val){ | |
_z = val; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment