When I obfuscate html code Chrome easily shows the original non-obfuscated html. I just need a simple obfuscation technique to make it harder to access the source code but the code cant be viewed in developer tools.
I tried obfuscating the html code to partially hide the source code but chrome developer tools got the original code immediately.
CodePudding user response:
The only secure way to protect your code is doing server rendering, in that way the client will only see what you wanna show
CodePudding user response:
<script>
document.write(atob("PHA dGhpcyBpcyBhIHRlc3Q8L3A "));
</script>
will output:
<p>this is a test</p>
Use your own string instead of "PHA dGhpcyBpcyBhIHRlc3Q8L3A "
for example:
window.btoa("<p>this is a test</p>")
will return the string you want.
Again, please note: Obfuscation isn't a secure solution, in the end, frontend code (HTML) will always be visible and modifiable by the user