Is it possible somehow to prevent users from being able to change JavaScript variables, trough the address bar or with programs like FireBug?
feedback
|
|
JavaScript is raw source code being interpreted on the client machine, so the short answer is no. The best you could perform as much work as you can on the server. Any JavaScript code you push to the client can be tampered with by the client. | ||||
|
feedback
|
|
This is one of those questions that pretty much begs the response "What is your ultimate goal?" As stated by others, no, you can't. JavaScript is client side so entirely in the hands of the client, not you. Obfuscation, as heavyd mentions, could be useful, but it's certainly not a secure/sure-fire way to prevent it. If this is something you need for security reasons, then the answer is likely that it shouldn't be done with client side JavaScript in the first place. | |||
|
feedback
|
|
No, but you can obfuscate your code to make it difficult to read and reverse engineer. | |||
|
feedback
|
|
You could create private variables and use an accessor method to get at them
| |||
|
feedback
|