It pays to get smart and protect your code from elements that are always looking for weak links to exploit for their nefarious reasons. HTML provides a very versatile array of functions, but your website can get seriously compromised if others gain access to your source code. Some steps that can be taken against this untoward event follow below.
For advanced users who are looking to get to your source code, this barrier may not pose much of a threat, but it still dissuades the more basic automated bots and malware from wreaking havoc.
Speaking of basic options, one of the earliest methods of ‘hiding’ source code can be put to use if you are so inclined, by including a large amount of blank space at the beginning of the code to make it seem like a retrieval error or graphics fault when someone tries to view the code.
The way to view source code is typically to right click the browser window in which the website is open, and select the view page source in Google Chrome (or similar command depending on browser to browser). You can take drastic measures and put in effort into removing the right click functionality from your website, which will make it a little harder for people to stumble upon your source code.
By taking these relatively simple steps, it becomes a little less likely for your source code to be compromised.