How can I hide or encrypt JavaScript code? [duplicate]
Solution 1:
You can obfuscate it, but there's no way of protecting it completely.
example obfuscator: https://obfuscator.io
Solution 2:
No, it's not possible. If it runs on the client browser, it must be downloaded by the client browser. It's pretty trivial to use Fiddler to inspect the HTTP session and get any downloaded js files.
There are tricks you can use. One of the most obvious is to employ a javascript obfuscator.
Then again, obfuscation only prevents casual snooping, and doesnt prevent people from lifting and using your code.
You can try compiled action script in the form of a flash movie.