'How to make html file encrypted?

I want to know, how to make my html file code to encrypted?
So that if normal user see the code, then they don't understand the code?



Solution 1:[1]

I don't remember how I did it, but I was just reading some of my own code recently and I couldn't even understand it. A normal user would not have a chance. I don't thing encryption was involved however.

Solution 2:[2]

You can't. If the user can't see it, the browser wouldn't be able to either!

Solution 3:[3]

This is called obfuscation, but it's pointless. People can still view your complete DOM tree in DOM Inspector or Firebug. As this Yahoo blog entry says, "If you don’t want people to see your programs, unplug your server." This applies equally to HTML.

Solution 4:[4]

Don't bother. All encryption will do for you is slow down your site. It's not worth 'hiding' it. Any moron can just open up Firebug and see everything without even having to decrypt the source code anyways.

Solution 5:[5]

This might be good: http://www.iwebtool.com/html_encrypter it's free and online makes your code into unicode hope less to copy and edit!

Solution 6:[6]

You may try disable the mouse right click. JS (jQuery):

$(document).bind('contextmenu',function(){return false;});

Again as shown in other posts this is actually meaningless because if someone want to view the source they can just press F12 to open the console and view all the codes.

Also, I don't think a normal user will want to see this kind of things. If they see that, they just think they're pressing the wrong button and close it.

Solution 7:[7]

You can use StatiCrypt to encrypt your HTML file using AES-256 encryption. You then get a simple HTML page with a password prompt, see example.

Two cautionary notes from the project's repository:

Disclaimer if you have extra sensitive banking data you should probably use something else!

...

AES-256 is state of the art but brute-force/dictionary attacks would be trivial to do at a really fast pace: use a long, unusual passphrase.

A similar tool is clientside-html-password. There might be others as well, but the bottom line is that you can make an HTML file encrypted.

Solution 8:[8]

I've written a tool to encrypt HTML files called PageCrypt. The tool asks for a password at the time of encryption, then spits out an encrypted HTML file. Then, when a user views the encrypted file, they need to input the set password to be able to unscramble and view it.

The tool is hosted here:

https://www.maxlaumeister.com/pagecrypt/

with source code available here:

https://github.com/MaxLaumeister/pagecrypt


Description of the project, from the project page:

PageCrypt - Password Protect HTML

This tool lets you securely password-protect an HTML file. Unlike other password-protection tools, this tool:

  1. Has no server-side components (this tool and its password-protected pages run entirely in javascript).

  2. Uses strong encryption, so the password-protection cannot be bypassed.

All you need to do is choose an HTML file and a password, and your page will be password-protected.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Brad The App Guy
Solution 2 PatrickJ
Solution 3 Matthew Flaschen
Solution 4 animuson
Solution 5 12345
Solution 6 Licson
Solution 7 Matias Kinnunen
Solution 8 Maximillian Laumeister