How to prevent the clientside user from changing arguments in an onClick function?
Question by user1113531
I just realized while testing an onClick function with firebug that it would be really easy for a user to change the value of the arguments being passed. This could mess thins up.
Is there any easy way to prevent this, especially when arguments need to be passed?
Answer by Quentin
It is impossible. The code is executing on the user’s computer. They are in control.
If they edit it and “mess it up”, then that is on their head.
If they edit it and it submits an HTTP request to your server, and your server allows (for instance) that request to delete data belonging to another user then the problem is that your server didn’t check that the user submitting the request had permission to delete that data before following through.
Answer by Starx
No, this simply can’t be done.
Once the script is loaded to the client’s machine. He can use/modify it, as he wants.