Skip to content

Instantly share code, notes, and snippets.

@bjrmatos
Forked from georgeOsdDev/gist:9501747
Last active May 24, 2022 19:21
Show Gist options
  • Save bjrmatos/1dfd15059b5a9969a6a0 to your computer and use it in GitHub Desktop.
Save bjrmatos/1dfd15059b5a9969a6a0 to your computer and use it in GitHub Desktop.
Disable JS execution in console
// 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