By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,115 Members | 763 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,115 IT Pros & Developers. It's quick & easy.

Javascript/AJAX in address bar

P: 115
Im afraid I may already know the answer to this..But i would like to hear from any one with some experience.

Is there any way at all, to prevent/detect if javascript was run from the address bar as opposed to my js file. I have numerous AJAX functions that i just dont want run from the address bar. (I discovered this trick after most of the app was written) audience wouldnt know what to do with this, but all you need is that one guy who just happens to know..and is not happy.

Any Ideas?
Mar 12 '08 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 5,390
since the javascript code is delivered to and executed at the client you cannot avoid such use of your code ... you could easyly run code from the address bar, from the firebug console or rewrite the page locally ... and: you just cannot avoid it ...

kind regards
Mar 12 '08 #2

rnd me
Expert 100+
P: 427
dont forget about greasemonkey and opera user-scripts.

in short: resistance to open source if futile in javascript, if the browser can see it, so can they.

that being said, you are free to make it inconvenient for users to do so.

using const instead of var, running delete on support functions once the page loads, over-riding the .toString() method for some of your functions and variables can all help to deter/complicate 'tampering'.

obfuscation and compression can help as well.
Mar 12 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.