1

Is it possible to detect if someone has altered the DOM/JS code on your webpage in the browser?

I'm thinking in terms of an online game written in JS, all the game code would be downloaded to the user's machine, which they can then edit to their will by using common script debugging/inspector tools. Are there any methods for detecting if the DOM/JS code has changed?

Brian Wigginton
  • 2,632
  • 3
  • 21
  • 28
  • Not sure what you're asking... – Josh Stodola Sep 17 '10 at 18:28
  • Say in my game I have a weapon that does 20 damage. Anyone could pop open firebug and change that value to 999, giving them the ability to have instant kills. Any way to detect this sort of change to the system? (I know i could validate the damage on the server end, but this is just one scenario) – Brian Wigginton Sep 17 '10 at 18:32
  • Nope, Javascript runs on the client-side and therefore the user-agent has full control over its execution. – Josh Stodola Sep 17 '10 at 20:59

1 Answers1

1

No, there is not. Even if there was such an event, it could be deleted or modified, just like the DOM.

If you want to create a game which is hacker-proof, you really need to validate all the user actions on the server side, not on the client side. I had the same questions about security of HTML5 games.

Community
  • 1
  • 1
Harmen
  • 22,092
  • 4
  • 54
  • 76