对用户隐藏 HTML 代码?
我尝试隐藏几个元素,以便最终用户在看到页面源代码时看不到它。这似乎不可能,因为浏览器将下载并读取此代码。因此,用户会找到一种方式来阅读它。
然而,我发现有些网站隐藏了部分来源!看看这个网站:http://namechk.com/ 。与站点列表相关的源代码不存在!! 该代码是 HTML 代码吗?还是有其他可以隐藏的东西? 有人知道一种方法吗?
谢谢
I tried to hide a couple of element so that the end users can NOT see it when they see the page source. It seems NOT possible because this code will be downloaded and read by the browser. So, the user will find a way to read it.
However, I found some websites that hide part of the source! Take a look at this website: http://namechk.com/ . The source code related to the sites list is NOT there!! Is the code an HTML code? or it is something else that can be hided?
And any one know a way to do this?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这是因为该页面严重依赖 javascript。但您也可以(并且您的浏览器也可以)下载 JavaScript。如果您深入研究它们,您会发现页面是如何生成的。
你可以混淆你的 JavaScript,但我认为这没有什么意义。您是否认为您的 HTML 如此独特以至于有人会窃取它?
It is because the page heavily relies on javascript. But you can (and your browser does) download the javascripts as well. If you dig into them you will find out how the page is generated.
You can obfuscate your javascript but I don't see much point in that. Do you think your HTML is so unique that somebody would steal it?
不可能对浏览器隐藏 html 代码。即使在您发布的链接中,html 代码也在那里。它只是动态加载的。看一下 Firebug 中的 DOM。
It is impossible to hide html code from the browser. Even in the link you posted the html code is there. It's just loaded dynamically. Have a look at the DOM in Firebug.
该网站没有显示详细信息,因为它使用 Asp.net、JavaScript 和 jQuery 来显示数据。
您可以在这里查看:http://w3techs.com/sites/info/namechk.com
不可能对客户端隐藏 html。
您可以做的一件事是使用 JavasSript 或 jQuery 删除不必要的元素。
The site is not showing the details because it is using Asp.net, JavaScript and jQuery to display data.
You can check it here: http://w3techs.com/sites/info/namechk.com
It is not possible to hide html from the client.
One thing you can do is remove unnecessary elements using JavasSript or jQuery.
HTML 可以隐藏在 iFrame 中,从另一个页面提取源代码(尽管他们可以从那里查看源代码)
HTML can be hidden in an iFrame, pulling the source from another page (though they could view the source from there)
您可以通过 ajax 调用将要隐藏的代码加载到 div 中。该 div 的内容不会在浏览器源中看到。
You could load code you want to be hidden into a div via an ajax call. The content of this div won't be seen in the browser source.