问题描述
我想知道是否有办法阻止用户修改jQuery或javascript的html页面来改变其行为。
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.
用户可以使用FireBug或Google Chrome开发者工具栏来修改它,以隐藏或显示div,将事件侦听器添加到页面元素等等。
A user can modify it using tools such as FireBug or the Google Chrome developer bar to hide or show divs, add event listeners to page elements and so on.
我见过一些当页面被加载时显示阻塞div的网页以及告诉回答某个问题的弹出窗口。如果你回答它,div就隐藏起来,你可以正常看到页面。
但是,如果您尝试使用FireBug隐藏阻止div,那么页面将重新加载,如果您没有在弹出窗口中查询问题,则无法正确查看页面。
I've seen some web pages showing a blocking div when the page is loaded and a pop-up telling to answer some question. If you answer it, the div hides and you can see the page normally.But if you try to hide the blocking div using FireBug, the page reloads and there is no way to see the page correctly if you don't ansewer the question asked in the pop-up.
我想知道如何阻止用户做这种事情。
I want to know how could I prevent user from doing such things.
非常感谢。
推荐答案
这是不可能的(这是很好)。
It is not possible (which is a very good thing).
这篇关于如何防止HTML / JavaScript代码修改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!