0

Possible Duplicate:
How can I obfuscate JavaScript?

Hi there, is there any way to encrypt code written in javascript, that's displayed in the browsers window..

Community
  • 1
  • 1
Akash
  • 4,956
  • 11
  • 42
  • 70

4 Answers4

2

The below link has a similar discussion and has answer to that.

How can I encrypt JavaScript code so that it's not decryptable?

Hope this will be helpful.

Community
  • 1
  • 1
clklachu
  • 951
  • 1
  • 7
  • 19
1

You mean that you want to obfuscate your javascript code so that others cannot read it properly?
Try jCompress or any other Javascript Minifiers

naveen
  • 53,448
  • 46
  • 161
  • 251
1

There is no way to encrypt (because otherwise the browser couldn't run the code) but you can obfuscate. Just search for 'Javascript Obfuscator' .

I wouldn't recommend this though, as obfuscators can cause bugs and it is possible to deobfuscate them.

Is there any reason why you want to encrypt the javascript?

david4dev
  • 4,854
  • 2
  • 28
  • 35
0

If you mean a way to encrypt it so it can't be stolen than the answer is no. The browser needs to be able to read the code to be able to execute it. There are tools to make it harder to read for humans but in the end you can't avoid people stealing your code.

Plenty of tools available on google. 1 Example: click

Mark Baijens
  • 13,028
  • 11
  • 47
  • 73