14

Possible Duplicate:
how to prevent your javascripts being stolen,copied, and viewed ?

What is the best way to secure the javascript code & make it hard to understand it and for sure steal it... I know that its impossible to secure it 100% since its client side and all the code the client can see it.. But I need to make it as hard as possible...

Community
  • 1
  • 1
Q8Y
  • 3,801
  • 12
  • 39
  • 38

3 Answers3

9

All you can do is minify and obfuscate it.

Here is a free obfuscator, there are several around.

Tom Gullen
  • 61,249
  • 84
  • 283
  • 456
4

First, obfuscate it - change functions/variables names to meaningless names. Then pack it using the packer.

Sergei
  • 2,747
  • 1
  • 17
  • 16
  • If do that.. obfuscate it then packer it... is it easy to deobfuscate it.. or it needs time to do that ?? I use the tool that "Tom Gullen"(Thank u ;) ) mention it .. – Q8Y Aug 09 '10 at 10:23
  • Also... Someone, told me a really also nice way to secure the code.. by securing the obfuscate with a key... I mean securing the secured already :) is it possible to do that, secure the code with a key & obfuscate it ?? thanks very much Guys, for ur help – Q8Y Aug 09 '10 at 11:21
3

100% securing of JS code is impossible. Whichever popular packer you use, JSBeautifier is usually able to reconstruct a humanly-readable source from it. Personally, I only use Google Closure Compiler which is the best minifier/optimizer currently available.

Onestone
  • 879
  • 9
  • 7
  • 2
    if its impossible 100%... how can i make it at least harder for normal user ?? since no matter what I obfuscate it, http://jsbeautifier.org/ will do the trick and deobfuscate it :) it will take a second to do that :) and for the Google Closure Compiler. they said that it only make your code run faster, they didn't mention any thing for securing and encrypting !! What should I do ?? I just want it hard for a normal user to see it, since the hacker no matter what I did they will see it eventually :) – Q8Y Aug 09 '10 at 13:58