Is it possible to make the HTML source not viewable?

Updated: 09/25/2024 by Computer Hope
View source code

In short, there's no method or script for making standard HTML (HyperText Markup Language), CSS (Cascading Style Sheets, Content Scramble System), or JavaScript source code not viewable. You may consider doing any of the following if you're concerned about your source code. However, realize that anyone familiar enough with web development could find ways around most of these suggestions or reverse engineer the suggestion to view the code.

Tip

Instead of worrying about others stealing your code, consider it an advantage you get to view the code of other amazing developers and programmers.

Do more server-side scripts

Creating server-side scripts that run on the web server instead of the user's browser help hide most of your code. With server-side scripts, the only code the visitors see is the output of the code. For example, most search engines are server-side scripts, and the search code is hidden from all visitors. However, if you design a client-side script (e.g., JavaScript) search engine, that source code is visible to all users.

Require a plug-in or extension

Use a plug-in like Adobe Flash, Java, or similar programs. The visitor would need to download the plug-in and cannot view the applet's source code.

Note

Adobe Flash is no longer used or supported by all modern browsers. So, while this could still be a solution, it would prevent most visitors from seeing your website.

Disable the visitor's mouse right-click button

JavaScript can be made to disable the mouse right-click feature some users use to view the source code or copy an image. However, this doesn't protect the source code of your page; it makes it difficult for some to access. For example, using a shortcut key, browser's menu, or saving the page could still allow access to the source code.

Obfuscate the code

There are programs designed to obfuscate (scramble) your code and make it difficult (not impossible) to read. Again, this doesn't prevent someone from viewing your code, but it may frustrate them enough that they don't want to view your code.