Freelance Web Designer in Dubai & SEO Expert in Kerala
01 / 01

5 ways to hide website’s source code

There is no actual way to hide it. Anything which a browser displays for end-users to view and interact with is accessible by anyone through source code. Server-side rendering of your code via PHP or other server-side language may help to remove from view sensitive code.

HTML CSS and JavaScript are client-side languages so the browser need to be able to find the source code easily and then interpret them so you can see your website.
Check out the following suggestions regarding Obfuscation and related facts for other possibilities:

1.Disable right Click for the page.

By disabling the right click you can prevent to a limit for copy the content from the website

<html>
 <head>
 <script>
 function disableClick(){
 document.onclick=function(event){
 if (event.button == 2) {
 alert('Right Click Message');
 return false;
 }
 }
 }
 </script>
 </head>
 <body onLoad="disableClick()">
 </body>
</html>

2.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.

3.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.

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.

4. HTML code Conversion tools

There is some html conversion tools like Muncher. It is a command line utility written in Python that rewrites classes and ids in CSS, HTML, and JavaScript files in order to save precious bytes and obfuscate your code. View source on this page to see it in action.

5.Create svg or jpeg of your view on the server

Not practical. But if you somehow created svg or jpeg of your view on the server. So one giant image in the body tag you could in theory hide your source code.

by anvar
Published : Feb , 1
  1. John

    Hello my greeting, You can hide the source of your page, also with this :I use this code:

    Thank you !

Post a comment

Your email address will not be published. Required fields are marked *

Categories

WhatsApp Logo Chat