I'm trying to control the commands that are executed in console so you can't acces some basic commands if you're the client.
I've tried to delete all the console using console = {}
, but it only deletes the console commands.
I'm trying to control the commands that are executed in console so you can't acces some basic commands if you're the client.
I've tried to delete all the console using console = {}
, but it only deletes the console commands.
Generally, that's impossible. A programmer can easily pause your JS code in any point and take out all the values and functions they could want.
If you want script-kiddies and browser extensions to not have acess to your classes and variables, don't place them in global (window) scope.
If you write
var a = 123;
let b = 'asd'
class C {}
then they exist in global scope and can be acessed as
window.a
window.b
window.C
To prevent that you should either scope them
function f(){
var a = 123;
let b = 'asd'
class C {}
}
f();
// no references here
or use <script type="module">
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules