Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the source code of a HTML page

I created an HTML page and now would like to hide the source code and encrypt it.

How can I do that?

like image 219
Francis Avatar asked Aug 10 '14 12:08

Francis


People also ask

How can I hide my HTML source code?

After encrypting it, you can just write a basic HTML page just putting into the <head> tag once again the script to disable the right click, into the <body> tag you code and hide everything just writing at top of the page <html hidden> .

How do I hide my source code not copied?

No, there is no way to hide one's code on the web. If you're sending information to the client-side, that information can be copied. That's not merely a fact of the web, that's a fact of information theory. The only option for cases like this is not prevention, but detection.

How do I prevent source code view?

you dnt need to hide your code becoz in every other process of your page source code will automatiaclly gets changed and by any mean you cannot hide hide source code any buddie can see source code by just go in chrome browser -> setting -> tools -> Developer tools(crtl + shift + i).


1 Answers

You can disable the right click, but that's a bad idea because expert minds can read anything from your page. You cannot totally hide the page source - this is not possible. Nothing is secure enough on the Internet.

In any case, you can encrypt it and set a password. You can utilise this link - it will encrypt your HTML page with a password.


First up, disable the right click, by writing out this script, right after the tag.

<SCRIPT language=JavaScript>

<!-- http://www.spacegun.co.uk -->

var message = "function disabled";

function rtclickcheck(keyp){ if (navigator.appName == "Netscape" && keyp.which == 3){ alert(message); return false; }

if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) { alert(message); return false; } }

document.onmousedown = rtclickcheck;

</SCRIPT>

Then, encrypt all of it, in this website, called 'AES encryption'.

Link - http://aesencryption.net/

You need to set a password to decrypt it ....you choose the password.

After encrypting it, you can just write a basic HTML page just putting into the <head> tag once again the script to disable the right click, into the <body> tag you code and hide everything just writing at top of the page <html hidden>.

Example

<!DOCTYPE html>
<html hidden>
<head>
<SCRIPT language=JavaScript>

<!-- http://www.spacegun.co.uk -->

var message = "function disabled";

function rtclickcheck(keyp){ if (navigator.appName == "Netscape" && keyp.which == 3){ alert(message); return false; }

if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) { alert(message); return false; } }

document.onmousedown = rtclickcheck;

</SCRIPT>
</head>
<body>
--here, you put the encrypted code from the link above--

</body>
</html>

Where it is written var message = "function disabled"; you can write for example something like 'This page cannot be viewed' or something which will annoy most of the users and will just leave. ['This page is unavailable' and so on ....].

Finally, you will see a blank page with a message coming up as soon as you right click the page. The message will be something like 'This page is no longer active'.

Example

  <SCRIPT language=JavaScript>

    <!-- http://www.spacegun.co.uk -->

    var message = "**This page is no longer active**";

    function rtclickcheck(keyp){ if (navigator.appName == "Netscape" && keyp.which == 3){ alert(message); return false; }

    if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) { alert(message); return false; } }

    document.onmousedown = rtclickcheck;

    </SCRIPT>

I do know that one can remove the <html hidden> or the Javascript script with some add-ons such as Firebug but anyway you will need to decrypt the code with a password in order to see the real page. Expert users might view the source code with a Brute Force attack, I think. So, nothing is safe.


I found out an application that you need to instal on your computer. There is a feature in the Enterprise version but you must pay to get it. This feature is a tool which encrypt your HTML page creating an ultra-strong password encryption for HTML files using up to 384 bit keys for encryption [the link I wrote above uses up to 256 bit keys for encryption]. I have never tried it out, though, because it is not for free.

Anyway, the link of the software 'HTML Guardian' - http://www.protware.com/default.htm For the feature about the encryption, merely click on 'Ultra-Strong HTML password protection' in the page.

like image 53
Francis UK Avatar answered Nov 02 '22 19:11

Francis UK