How to hide html source code of website when user use view source option | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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

Especially hide script tag on body html

11th Nov 2022, 2:44 AM
Saila S Amanatillah
Saila S Amanatillah - avatar
1 Answer
+ 4
1. Put the script in separate file and link it in the html head. Then 'view source' would not display it. 2. There are tools to minify the code, to make it smaller (less size means quicker load) and to obfuscate it so it would be less readable, but it is still sent to the client and can be discovered, and eventually reverse engineered. https://www.minifier.org/ 3. You can generate static pages on the server (based on dynamic logic), and send only the html to the client. There are frameworks like Gatsby that do this for you. https://www.gatsbyjs.com/
11th Nov 2022, 4:28 AM
Tibor Santa
Tibor Santa - avatar