-2

Possible Duplicate:
How can I obfuscate JavaScript?

I have some complex Jquery/Javascript code wich i want to protect from reading. Is there a possibility to put the code in a map wich is only acceable for the webserver? So others can view the page with the jquery functionality, but can't read the sourcecode?

Community
  • 1
  • 1
Jilco Tigchelaar
  • 2,065
  • 8
  • 31
  • 51

2 Answers2

3

No, and for a good reason: users should always have control over what's executed in their user agents. Why don't you just minify and obfuscate the code?

MaxArt
  • 22,200
  • 10
  • 82
  • 81
  • Obfuscation *DOES NOT* prevent the code from being read. – Joseph Aug 11 '12 at 10:47
  • @JosephtheDreamer Yes indeed, neither minification does, but it makes it more difficult to be read. – MaxArt Aug 11 '12 at 10:48
  • You missed the point. "So others can view the page with the jquery functionality, ***but can't read the sourcecode***?" - the code can still be read. Both methods can even be reversed. – Joseph Aug 11 '12 at 10:49
1

No, if the Javascript is executed in the browser the source can be read.

Strille
  • 5,741
  • 2
  • 26
  • 40