How to Hide My Source Code So to Not Be Copied

how to hide my source code so to not be copied

Don't do this! It makes no sense to do this, since the user can disable the script,
and there are many tools like Firebug by which a user can see the code.

The best way to keep safe the store is installing a security camera while leaving the doors open.

You can simply disable the right click by following:

<body oncontextmenu="return false">
...
</body>

or

<script language="javascript">
document.onmousedown = disableclick;
status = "Right Click Disabled";
Function disableclick(e)
{
if(event.button == 2)
{
alert(status);
return false;
}
}
</script>

The code above is from this article

What are some good ways to prevent people from copying my source code?

If people really want to get access to your source code they can do that fairly easily.

It is possible to slow people down to a limited degree by obfuscating code.

See:

  • http://code.google.com/p/minify/
  • http://refresh-sf.com/yui/
  • http://ajaxian.com/archives/utility-javascript-obfuscator

Maintaining obfuscated code is difficult. What you want to do is obfuscate it before deployment so that you can test and debug with the normal version. Debugging problems on a live site can be made a lot more difficult by the obfuscation.

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

The following website has both right click and view source disabled.

They fooled you. Just scroll down in view-source.

Furthermore, employing such tactics marks you as unprofessional. Don’t do it.

How to hide the source code of a HTML page

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.

How to hide html source code of website when user use view source option

Another silly option which allows you not to show the source code is by doing a Single Page Application (all modern Javascript framework like Angular, React or Vue are made in this scope).

In this case the source code will be an index.html file nearly empty.
The html will be generated dynamically through you javascript code (by the use of template or JSX syntax)

PS: in this way you can still see the generated html in the console of the browser (like Elements tab in Chrome)

Is there any way to hide css code from source code

There is NO way to hide the client side components like CSS.

you can check it here

can i hide the html source code from the browser view source?

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.



Related Topics



Leave a reply



Submit