简体   繁体   English

如何防止用户通过js控制台操纵我的页面?

[英]How can I prevent users from manipulating my page via the js console?

I tried to manipulate the divs on facebook.com using the javascript console to see if it was possible. 我尝试使用JavaScript控制台在facebook.com上操作div,以查看是否有可能。 I noticed there was a class called "profileLink", so I typed the following into my console: 我注意到有一个名为“ profileLink”的类,因此我在控制台中键入了以下内容:

$(".profileLink").hide();

But instead of the class being hidden, I got the following error in my console: 但是,不是隐藏类,而是在控制台中出现以下错误:

Error: <![EX[["Tried to get element with id of \"%s\" but it is not present on the page.",".profileLink"]]]>

But the method I tried works to manipulate other, lower-budget webpages. 但是我尝试的方法可以操纵其他预算较低的网页。 How did facebook accomplish this? Facebook是如何做到这一点的?

I'm pretty sure Facebook isn't preventing you, but the $ is not associated with jQuery. 我很确定Facebook不会阻止您,但是$与jQuery没有关联。

$ isn't a built in to browsers, but usually is an alias for jQuery. $不是浏览器内置的,但通常是jQuery的别名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM