0
How to hide html source code of website when user use view source option
Especially hide script tag on body html
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/