Skip to content Skip to sidebar Skip to footer

How To Hide Or Secure Javascript Code From Client Side

How to secure or hide javascript code on client side. Is there any way to doing so. Thank You

Solution 1:

Short answer: You can't/don't.

Longer answer: You cannot hide it at all. It runs on the client and it cannot be compiled to machine code. However, you could minify it - that's basically obfuscating it by shortening variable names, removing whitespace, etc. While it's usually used to save bandwidth it also makes the code less readable. Note that all but the changed variable names and removed comments can be easily undone by something like jsbeautufier.. but for a large application it's very hard to understand the code without any meaningful variable/function names or comments.

Solution 2:

There is no such thing as 100% secure javascript code. This is because any code executed on the client's machine cannot be fully secure. Your best bet is to obfuscate your javascript and make it hard to read.

Your best bet is to ensure all vital secure code runs on the server, and allow javascript to do only simple, UI enhancing tasks on the client side.

Solution 3:

As i know it is not possible. Only thing you can do it making the code very badly organized. Which will take longer time to find out actually what you are doing.

If you are searching this because of security reasons, you have to remember the only thing matters in security is the password-which is not put in the code. So find a nice way to encrypt you stuff. You can find many good ways on web.

Post a Comment for "How To Hide Or Secure Javascript Code From Client Side"