Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to make a javascript "loadable" but not viewable/readable?

Tags:

javascript

Is it possible to have clients have access to load a javascript but still be denied access from accessing the page that it is stored on?

like image 336
zane Avatar asked Jul 20 '26 18:07

zane


1 Answers

This is not possible. Because Javascript is client-side, there is no way to prevent a client from viewing your source without blocking them from using it.

Minification and obfuscation can make it more difficult to discover what is going on in your code, but someone can use a tool like jsbeautifier to thwart your efforts.

You can protect yourself with a license (which you should do, both for yourself and others), but you cannot "lock down" JS in the way that you might with server side languages.

like image 102
Nick Tomlin Avatar answered Jul 22 '26 09:07

Nick Tomlin