si yan
si yan

Reputation: 365

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. A HTML page exposes some interfaces and url in the browser source code view. Someone takes advantage of this to get the resource of urls and download resource without paying. 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. The other way is to encrypting the HTML source code. The method I find is to use escape. I am new to JavaScript. I wonder how to use some crypto encryption methods, such as AES, MD5, to do this work. Thanks for your help.

Upvotes: 0

Views: 660

Answers (1)

Quentin
Quentin

Reputation: 943630

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();

Upvotes: 2

Related Questions