-1

Possible Duplicate:
Protecting client side logic & data

How can I block other from reading my JavaScript through view source?

My thing is, now one can access my JavaScript, because am not sure, but just guess some one from outside using some tool to changing my JavaScript events.

So how to make the authenticated?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Bharanikumar
  • 25,457
  • 50
  • 131
  • 201
  • 2
    If you mean Javascript obfuscation see http://stackoverflow.com/questions/194397/how-can-i-obfuscate-javascript Regarding someone changing your script locally you can't avoid it. People can use Greasemonkey, Firebug, Adblock etc. to change your page your page behavior locally, that's just how the web work. – Alex Jasmin Oct 29 '10 at 05:22

2 Answers2

3

You don't control the client, and javascript isn't compiled. Its a losing battle if you want to lock it down completely. The best you can hope for is a good obfuscator/compressor that would make it more difficult to read. You can also do it all in flash or something where you would have a bit more say, but you still don't control the client, and they can still decompile the source.

Bruce Armstrong
  • 1,562
  • 10
  • 11
1

It's not entirely possible for you to block your JavaScript code from getting into the client side, since this is where they will get executed. As you mentioned about changing the events, your Application must be developed in a such a way that such changes will not harm the Application at the server end. Of course, that particular user will be able to produce unanticipated output it his end, but these should hardly matter as he will be the sole viewer of those.

One side note though, there is something called code obfuscation, that is making the code deliberately unreadable. Some Web App developers resort to that. You could consider doing that.

Shamim Hafiz - MSFT
  • 21,454
  • 43
  • 116
  • 176
  • in my interview they asked this question, i said no, but they said somthing like , using event binding , we can restrict others using our script, – Bharanikumar Oct 29 '10 at 05:28
  • 1
    I once saw someone disable the showing of options that come up by clicking the right mouse button on the browser. It was done by executing some kind of script. But this too isn't fool proof to prevent user at client end from seeing the JavaScript codes. – Shamim Hafiz - MSFT Oct 29 '10 at 05:33