DEV Community

Discussion on: How to hide JavaScript code form view source

Collapse
 
schmoris profile image
Info Comment hidden by post author - thread only visible in this permalink
Boris

Obfuscating is not the same as hiding, as the title of this post suggests.

Never(!) put sensitive data into your client-side JavaScript, it can always be read with little effort. Either by un-minifying tools, by reading the code and replacing variables- and function-names with what you think they do, or just by simply asking ChatCPT what the code does. Obfuscation is not a security measure or at least it shouldn't be your only one.

As @martinfjant suggested, a minifier is obfuscating enough.

Collapse
 
ysf00009 profile image
YSF

Hi, I'm just talking about "vanilla" Javascript : I'm making this post to show peoples how to hide his frontend code not backend

Collapse
 
schmoris profile image
Boris

You can not hide client-side JavaScript. That's why it's called obfuscating and not hiding :-)

It's hard to read, but still accessible in the source code.

Thread Thread
 
ysf00009 profile image
YSF

Thx, for the information

Some comments have been hidden by the post's author - find out more