我可以从浏览器视图源隐藏html源代码吗?(can i hide the html source code from the browser view source? [duplicate])

这个问题在这里已经有了答案:

如何隐藏html源并禁用右键单击和文本复制? 17个答案

我想知道我可以隐藏浏览器的源代码(HTML PAGE专用)。 viewsource ? 如果yes怎么样? 如果no其他方式来保护我的页面代码?

This question already has an answer here:

How to hide html source & disable right click and text copy? 18 answers

I want to know can i hide the source code(special for HTML PAGE) from browsers.viewsource ? if yes than how ? And if no than other way to secure my page code ?

最满意答案

不,你不能这样做。有效隐藏HTML是不可能的。

您可以阅读此内容,因为这将为您提供其他一些保护页面的方法。

源代码填充

真的,这本书中最古老的技巧。 它涉及在代码开始之前添加大量空白区域,以便查看源菜单显示为空白。 但是,所有人都必须注意滚动条并滚动查找代码。 像这种方法一样毫无意义和愚蠢,仍然有一些人使用它。

没有右键单击脚本

这些脚本阻止用户右键单击“查看源”功能所在的位置。 缺点:众所周知,难以跨浏览器工作并且实际上正常工作。 右键单击菜单或上下文菜单包括许多有用的用户工具,包括导航按钮和“书签页面”按钮。 大多数用户不善待他们的浏览器功能被禁用,并且倾向于不重新访问这些页面。 View Source功能也可通过顶部菜单获得。 在浏览器顶部的主菜单栏中,选择“查看”,然后在子菜单中,您将看到“查看源”或类似内容。 此外,还有键盘快捷键,如Ctrl + U,可用于查看源。 所有这些方法都会给尝试查看源代码的人增加大约两秒钟的延迟,并且会激怒那些不想查看源代码的用户。

“JavaScript加密”

这是迄今为止尝试隐藏某个源代码的最常用方法。 它涉及获取代码,使用自定义函数以某种方式对其进行“加密”,然后将其放入HTML文件以及将为浏览器解密的函数。 用户可以查看源,但这是不可理解的。 缺点:您的网站仅适用于启用了JavaScript的用户。 这排除了搜索引擎,选择禁用JavaScript的用户以及使用没有JavaScript功能的文本浏览器(例如盲人)的用户。 请记住,JavaScript是一种奢侈品,而不是网络上的必需品。 您必须包含解密页面的方法,以便浏览器可以显示它。 了解JavaScript的人可以轻松解密页面。 许多浏览器提供了替代方法。 有些允许您保存页面,解密以便以后查看。 其他人,如FireFox,包括DOM Inspector等工具,它允许您轻松查看和复制页面的XML,并进行解密。

HTML保护软件

有些不太诚实的人想要出售软件,以便快速方便地“保护”您的源代码。 这种类型的软件通常以不同的方式使用上述方法来隐藏源代码。 许多人认为,如果他们购买它,它必须工作。 它没有。 正如我们所看到的,上述方法都很容易被规避,所有这些软件都是为你实现这些可怕的方法并拿走你的钱。 不要为他们堕落,我还没有看到一个有效的,他们永远不会。

如果链接将来死亡,则复制内容。

No you cant do that.It is impossible to effectively hide the HTML.

You can read this as this will give you some other alternatives to secure your page.

Source Code Padding

Really, the oldest trick in the book. It involves adding a ton of white space before the start of your code so that the view source menu appears blank. However, must all people will notice the scroll bars and will scroll around to find your code. As pointless and silly as this method is, there are some still who use it.

No Right Click Scripts

These scripts stop users from right-clicking, where the "View Source" function is located. Cons: Notoriously hard to get working across browsers and to actually work properly. The right-click menu, or context menu, includes many helpful tools for users, including navigation buttons and the "Bookmark Page" button. Most users don't take kindly to having their browser functionality disabled and are inclined not to revisit such pages. The View Source function is also available through the top Menu. At the main menu bar at the top of your browser, select View, and then in the sub-menu, you'll see "View Source" or something similar. Also, there are keyboard shortcuts like Ctrl+U that can be used to view source. All this method does is add about a two second delay to someone trying to view your source and it does irritate users who aren't trying to view your source.

"JavaScript Encryption"

This is by far the most popular way to try to hide one's source code. It involves taking your code, using a custom made function to "encrypt" it somehow, and then putting it in an HTML file along with a function that will decrypt it for the browser. A User is able to view the source, however, it isn't understandable. Cons: Your website is only usable for users with JavaScript enabled. This rules out search engines, users who've chosen to disable JavaScript, and users using a textual browser (such as the blind) that doesn't have JavaScript capabilities. Remember, JavaScript is a luxury, not a necessity on the web. You have to include a means of decrypting the page so the browser can display it. Someone who understands JavaScript can easily decrypt the page. Many browsers provide alternative ways around this. Some allow you to save the page, decrypted for easy viewing later. Others, like FireFox, include tools like the DOM Inspector, which allows you to easily view and copy the XML of the page, decrypted.

HTML Protection Software

There are some less than honest people who want to sell you software to quickly and conveniently "protect" your source code. This type of software generally employs the above methods, in varying ways, to hide your source code. Many people think that if they are buying it, it must work. It doesn't. As we've seen, the above methods are all easily circumvented, and all this software does is implement these horribly flawed methods for you and take your money. Don't fall for them, I've yet to see a single one that's worked, and they never will.

Copied the content if in case the link goes dead in future.

我可以从浏览器视图源隐藏html源代码吗?(can i hide the html source code from the browser view source? [duplicate])

这个问题在这里已经有了答案:

如何隐藏html源并禁用右键单击和文本复制? 17个答案

我想知道我可以隐藏浏览器的源代码(HTML PAGE专用)。 viewsource ? 如果yes怎么样? 如果no其他方式来保护我的页面代码?

This question already has an answer here:

How to hide html source & disable right click and text copy? 18 answers

I want to know can i hide the source code(special for HTML PAGE) from browsers.viewsource ? if yes than how ? And if no than other way to secure my page code ?

最满意答案

不,你不能这样做。有效隐藏HTML是不可能的。

您可以阅读此内容,因为这将为您提供其他一些保护页面的方法。

源代码填充

真的,这本书中最古老的技巧。 它涉及在代码开始之前添加大量空白区域,以便查看源菜单显示为空白。 但是,所有人都必须注意滚动条并滚动查找代码。 像这种方法一样毫无意义和愚蠢,仍然有一些人使用它。

没有右键单击脚本

这些脚本阻止用户右键单击“查看源”功能所在的位置。 缺点:众所周知,难以跨浏览器工作并且实际上正常工作。 右键单击菜单或上下文菜单包括许多有用的用户工具,包括导航按钮和“书签页面”按钮。 大多数用户不善待他们的浏览器功能被禁用,并且倾向于不重新访问这些页面。 View Source功能也可通过顶部菜单获得。 在浏览器顶部的主菜单栏中,选择“查看”,然后在子菜单中,您将看到“查看源”或类似内容。 此外,还有键盘快捷键,如Ctrl + U,可用于查看源。 所有这些方法都会给尝试查看源代码的人增加大约两秒钟的延迟,并且会激怒那些不想查看源代码的用户。

“JavaScript加密”

这是迄今为止尝试隐藏某个源代码的最常用方法。 它涉及获取代码,使用自定义函数以某种方式对其进行“加密”,然后将其放入HTML文件以及将为浏览器解密的函数。 用户可以查看源,但这是不可理解的。 缺点:您的网站仅适用于启用了JavaScript的用户。 这排除了搜索引擎,选择禁用JavaScript的用户以及使用没有JavaScript功能的文本浏览器(例如盲人)的用户。 请记住,JavaScript是一种奢侈品,而不是网络上的必需品。 您必须包含解密页面的方法,以便浏览器可以显示它。 了解JavaScript的人可以轻松解密页面。 许多浏览器提供了替代方法。 有些允许您保存页面,解密以便以后查看。 其他人,如FireFox,包括DOM Inspector等工具,它允许您轻松查看和复制页面的XML,并进行解密。

HTML保护软件

有些不太诚实的人想要出售软件,以便快速方便地“保护”您的源代码。 这种类型的软件通常以不同的方式使用上述方法来隐藏源代码。 许多人认为,如果他们购买它,它必须工作。 它没有。 正如我们所看到的,上述方法都很容易被规避,所有这些软件都是为你实现这些可怕的方法并拿走你的钱。 不要为他们堕落,我还没有看到一个有效的,他们永远不会。

如果链接将来死亡,则复制内容。

No you cant do that.It is impossible to effectively hide the HTML.

You can read this as this will give you some other alternatives to secure your page.

Source Code Padding

Really, the oldest trick in the book. It involves adding a ton of white space before the start of your code so that the view source menu appears blank. However, must all people will notice the scroll bars and will scroll around to find your code. As pointless and silly as this method is, there are some still who use it.

No Right Click Scripts

These scripts stop users from right-clicking, where the "View Source" function is located. Cons: Notoriously hard to get working across browsers and to actually work properly. The right-click menu, or context menu, includes many helpful tools for users, including navigation buttons and the "Bookmark Page" button. Most users don't take kindly to having their browser functionality disabled and are inclined not to revisit such pages. The View Source function is also available through the top Menu. At the main menu bar at the top of your browser, select View, and then in the sub-menu, you'll see "View Source" or something similar. Also, there are keyboard shortcuts like Ctrl+U that can be used to view source. All this method does is add about a two second delay to someone trying to view your source and it does irritate users who aren't trying to view your source.

"JavaScript Encryption"

This is by far the most popular way to try to hide one's source code. It involves taking your code, using a custom made function to "encrypt" it somehow, and then putting it in an HTML file along with a function that will decrypt it for the browser. A User is able to view the source, however, it isn't understandable. Cons: Your website is only usable for users with JavaScript enabled. This rules out search engines, users who've chosen to disable JavaScript, and users using a textual browser (such as the blind) that doesn't have JavaScript capabilities. Remember, JavaScript is a luxury, not a necessity on the web. You have to include a means of decrypting the page so the browser can display it. Someone who understands JavaScript can easily decrypt the page. Many browsers provide alternative ways around this. Some allow you to save the page, decrypted for easy viewing later. Others, like FireFox, include tools like the DOM Inspector, which allows you to easily view and copy the XML of the page, decrypted.

HTML Protection Software

There are some less than honest people who want to sell you software to quickly and conveniently "protect" your source code. This type of software generally employs the above methods, in varying ways, to hide your source code. Many people think that if they are buying it, it must work. It doesn't. As we've seen, the above methods are all easily circumvented, and all this software does is implement these horribly flawed methods for you and take your money. Don't fall for them, I've yet to see a single one that's worked, and they never will.

Copied the content if in case the link goes dead in future.