How to prevent html/JavaScript code modification

前端 未结 8 1891
一向
一向 2020-11-30 13:17

I would like to know if there is a way to prevent an html page with jQuery or javascript to be modified by the user to change its behavior.

A user can modify it usin

8条回答
  •  悲哀的现实
    2020-11-30 13:45

    For sure you can't prevent anybody from doing what he wants to, but you can make changes more difficult.

    Take a look at the DOMEvents, especially the Mutation-Events. Those give you the ability to see when something has changes(attributes, removed/inserted nodes, data in textnodes ...). For example you could build a function that watches some special attributes you would'nt have to get changed and reload the page, if this happens.

提交回复
热议问题