tags:

views:

183

answers:

4

How can I prevent my javascript from Firebug view?So that I can prevent Hacking from Javascript?

+1  A: 

You generally can't prevent people from seeing/debugging your js code. There are ways how to make their life miserable but please don't even think about it.

Jakub Hampl
try to check stackoverglow's(this site's) script form Firebug.. You can not watch Javascript. so it is possible, but i dont know how
Dhaval dave
A: 

If you mean what Felix Kling thinks you mean, you can't. You can obfuscate it, but if you want the browser's Javascript interpreter to run it, it has to be readable by the browser, which makes it effectively public information.

T.J. Crowder
A: 

That is impossible. The user will always have a means of executing javascript in the browser - if not using Firebug, then using the pseudo protocol handler javascript: in the address field.

Sean Kinsey
try to check stackoverglow's(this site's) script form Firebug.. You can not watch Javascript. so it is possible, but i dont know how
Dhaval dave
You mean this: http://sstatic.net/so/js/master.js?v=aed826386fce ?That it doesn't show up in Firebug is most likely a coincidence as Firebug tends to err with some scripts..
Sean Kinsey
+6  A: 

You cannot prevent anyone to examine your JS when browsing your page.

The reason is simple: When you visit a web site, all its content (HTML, images, scripts, etc.) is downloaded to your machine in order to process and display it.

Once the data is downloaded, you can do what ever you want with it (if it is legal is another issue).

But you can make it more difficult for others to examine your JS code by obfuscating it.

See this question: How can I obfuscate JavaScript?


This might or might help. It won't stop those who really want to know.

The question is, is your code so valuable, dangerous or whatever that you really have to think about such stuff?

Felix Kling
+1 - I would add that this only slightly hinders anyone trying to see your javascript, it's a deterrent and not a stop: http://stackoverflow.com/questions/2302618/getjson-and-php-file
Nick Craver
@Nick Craver: Yep I just had the same idea ;)
Felix Kling
@ Felix Kling :is right I actually meant that My JS should not be discoverable by Firebug
Dhaval dave