DEV Community

Cover image for How to hide JavaScript code form view source
YSF
YSF

Posted on

How to hide JavaScript code form view source

Hi, and welcome back in a new Tutorial
i was simple to hide your javascript code its just go to this website : https://www.obfuscator.io/ and past your javascript code then click "Obfuscate" automatically the website convert your code to a sysntax can't humain read and or undrestand it. then copy the code in the "Output" and past it in your project
Now!! you have a javascript code can't humain undrestand but can machine

Top comments (8)

Collapse
 
martinfjant profile image
Info Comment hidden by post author - thread only accessible via permalink
Martin Falk Johansson

This is generally a really, really bad idea. If you use a minimiser like uglify or terser, that should really be enough to make the code nigh unreadable. The chance that someone will go into your bundled and minimised javascript and steal it is pretty much zero.

If you think you need this, you are most certainly someone who does not need this. If you need a GUI to do this, rather than just using the cli tool from NPM, you are not a programmer good enough anyone would steal from.

As for a tutorial, this is just a link. You have shown us nothing. Quality is better than quantity. Writing these kind of tutorials won't get you a job – if someone sees this is the quality of what you do it can even hurt your prospects.

Collapse
 
ysf00009 profile image
YSF

HHh, thanks ,because you are afraid of my future, I'm Nothing to do with JS I'm a Laravel devlopper

Collapse
 
martinfjant profile image
Martin Falk Johansson

Then why are you writing bad tutorials that teaches things you should not do in JS?

Thread Thread
 
ysf00009 profile image
YSF • Edited

I think you don't have any problem, right?

Collapse
 
schmoris profile image
Info Comment hidden by post author - thread only accessible via 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