How to protect javascript function? [duplicate]
Possible Dupl开发者_如何转开发icate:
How can I obfuscate JavaScript?
Is there any way to protect my js file or javascript function from user to view?
You could minify/obfuscate it but the function would still be visible to the user.
Nope but you can always obfuscate. just look up online for javascript obfuscator. It makes code harder to read but it'll still be decodable.
If you need to hide code may I suggets something serverside such as php, aspx etc..
Like Darin sayd, you can obfuscate the code. But if you want execute a js file on a browser, the user can get the source code. There is no way to avoid this.
精彩评论