8 Years
Discussion Span
Last Post by sergb

I don't think its possible. The client-side code must know the URL to which to send the request. You can assign the URL to a javascript variable, the variable could be loaded in another .js file, and then you can substitute that variable for the raw URL when calling the getJSON function.

The bottom line is that the jquery/ajax code needs to know the url to work as expected. If you are simply trying to hide it from "right click -> view source", try loading it into a variable in another .js file. If you are trying to hide it from users, then thats a lot harder. Anyone with a Firebug plugin for Firefox can trace all AJAX calls including the URLs they were sent to.

Even if you setup some kind of URL re-writing scheme, the user can still request the URL found in your page source and the server-side would not know the difference.

Edited by sergb: n/a


If you don't want people to browse to that location, why are you using it? What is at that location that you don't want people to access?




I have only data in this location, but I want know, it is possible to hidden this link;)


Yes. To hide the link, use a token. If you don't want the link accessible, full stop, don't put it on your website!

If you want people to access the content, you have to link to the content... that is how the internet works...


Hidden value for what? For the URL itself? Or are you trying to hide the output of the page file.php if it is not requested from the javascript?

If latter is the case, here is something you can try.

1) Set a cookie with some known value (the return value of time() for example).
2) Pass that same value in your URL.
3) In the PHP code check the value passed in the query string with that set in the cookie and only if they match output the content.

Of course, this can also be bypassed fairly easy.

Edited by sergb: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.