Disable editting of javascript from chrome console? -
So, I have just seen that you can explicitly run JavaScript in Chrome console. I did not know you did it You can. This really is really good.
In my train app, I have an external javascript page, some variables that I want to be global on that page so that all functions in the JS file can be used by them. For example, I have a map, and I would like the map object to be global in a javascript file because in this way all my functions use a single map variable instead of my own, and I use complex tasks I can break into functions.
It's all well and good. I know how to do this and it's working perfectly. My problem now, can I protect the variable from the outside? For example, you can change the values of all JavaScript class variables from Chrome console. For example, there are ways in which the map is accessible and executable. I have locked the map settings on one page, so it Can not say zooming or running, I can just say Edit Thanks for the answers and comments. I think I will not just do anything that can be malicious in my javascript, and I do it by doing so, where my variables pass my variable for the necessary tasks to slow down my people. To prevent you from exposing your variables and actions, the instant-action function (IIFE) In the global area you can use: < / P> I'm sure there is a way to edit map.setZoom (11) from the console and zoom to map 11 .. I
map.dragable = true Can I type the map .. I really like it It is not too bad, as if it is not the worst thing in the world to drag the map and zoom to the user .. but still I want to disable it like a idea?
var a = 10; (Function () {var b = 20;}) ();
window.a lets you view and modify
a , but you can replace it with
b Can not:
b with the inspector, but I have not taken the time to understand it. Do not waste your time trying to prevent your users from modifying the code they can see.
Comments
Post a Comment