如何禁用或加密“查看源”对于我的网站 [英] How to disable or encrypt "View Source" for my site

查看:107
本文介绍了如何禁用或加密“查看源”对于我的网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法为我的网站禁用或加密查看来源,以便我可以保护我的代码?

Is there any way to disable or encrypt "View Source" for my site so that I can secure my code?

推荐答案

Fero,

你的问题没有多大意义。 查看来源显示HTML源代码 - 如果您对其进行加密,则用户(和浏览器)将无法再读取您的内容。

Your question doesn't make much sense. The "View Source" is showing the HTML source—if you encrypt that, the user (and the browser) won't be able to read your content anymore.

如果您希望保护您的PHP源代码,然后有 Zend Guard 等工具。它会加密你的源代码并使其难以进行逆向工程。

If you want to protect your PHP source, then there are tools like Zend Guard. It would encrypt your source code and make it hard to reverse engineer.

如果你想保护你的JavaScript,你可以用它来缩小它,例如, YUI Compressor 。它不会阻止用户使用您的代码,因为与用户一样,浏览器需要能够以某种方式读取代码,但至少会使任务更加困难。

If you want to protect your JavaScript, you can minify it with, for example, YUI Compressor. It won't prevent the user from using your code since, like the user, the browser needs to be able to read the code somehow, but at least it would make the task more difficult.

如果您更担心用户隐私,则应使用 SSL 来确保敏感信息在线上加密。

If you are more worried about user privacy, you should use SSL to make sure the sensitive information is encrypted when on the wire.

最后,技术上可以加密页面内容并使用JavaScript解密,但由于这依赖于JavaScript,经验丰富的用户可以在几分钟内击败它。加上所有这些问题都会出现:

Finally, it is technically possible to encrypt the content of a page and use JavaScript to decrypt it, but since this relies on JavaScript, an experienced user could defeat this in a couple of minutes. Plus all these problems would appear:


  • 搜索引擎将无法为您的网页编制索引......

  • 禁用JavaScript的用户会看到加密的页面

  • 根据您拥有的内容量,它可能表现不佳

所以我建议你不要使用这个解决方案。

So I don't advise you to use this solution.

这篇关于如何禁用或加密“查看源”对于我的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆