Skip to content

Instantly share code, notes, and snippets.

@georgeOsdDev
Created March 12, 2014 06:08
Show Gist options
  • Save georgeOsdDev/9501747 to your computer and use it in GitHub Desktop.
Save georgeOsdDev/9501747 to your computer and use it in GitHub Desktop.
Disable javascript execution from 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;
}
});
@VladyslavKvaskov
Copy link

It doesn't work. I have been looking for the solution for hours. If I find it, I will post it here in the comment section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment