简体   繁体   English

如何在使用浏览器获取源代码视图时隐藏 HTML 源代码中的链接?

[英]How to hide links in HTML source code while using browser to get source code view?

Something like this <a href="url">...</a> in an HTML page can be get in the browser source code view when press F12.当按 F12 时,可以在浏览器源代码视图中获取 HTML 页面中的类似<a href="url">...</a>的内容。 A HTML page exposes some interfaces and url in the browser source code view. HTML 页面在浏览器源代码视图中公开了一些接口和 url。 Someone takes advantage of this to get the resource of urls and download resource without paying.有人利用这一点,无需付费即可获取 url 的资源并下载资源。 I wonder how to encrypt the urls so that no one can download resources without paying.我想知道如何加密网址,以便没有人可以不付费下载资源。 I search for this question.我搜索这个问题。 I get the following solutions, but I think maybe they are not secure enough.我得到以下解决方案,但我认为它们可能不够安全。 I find that disabling some key such as F12, Shift+F10 can be a solution.我发现禁用某些键(例如 F12、Shift+F10)可能是一种解决方案。 The other way is to encrypting the HTML source code.另一种方法是加密 HTML 源代码。 The method I find is to use escape .我找到的方法是使用escape I am new to JavaScript.我是 JavaScript 的新手。 I wonder how to use some crypto encryption methods, such as AES, MD5, to do this work.我想知道如何使用一些密码加密方法,例如 AES、MD5 来完成这项工作。 Thanks for your help.谢谢你的帮助。

Your approach to this is entirely wrong.你的做法是完全错误的。

If you don't want the user to have something, then just don't give it to them .如果您不希望用户拥有某些东西,那么就不要给他们 Don't give it to them wrapped in some form of encryption.不要将其以某种形式的加密形式提供给他们。

If you don't want the link to work without the user paying then use server side code which has logic along the lines of:如果您不希望链接在没有用户付费的情况下工作,请使用具有以下逻辑的服务器端代码:

if (!userHasPaid()) {
    redirect(sales_page);
    exit;
}
provideDownload();

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

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