how to read URL hash? |
[eluser]keevitaja[/eluser]
is there a way to access following: http://site.com/#/var1/var2 i would need to get everything after # like segment_array() gives me
[eluser]Bhashkar Yadav[/eluser]
you can you parse_url() function of PHP like Code: $u = parse_url($url);
[eluser]keevitaja[/eluser]
how do i get the url into $url variable from browser?
[eluser]keevitaja[/eluser]
it doesn't work that way. with site.com/test/#/var1 i get only test. everything after # is excluded
[eluser]Bhashkar Yadav[/eluser]
ahhh, yes, you are right .. i am also digging into it to find the solution. sorry for giving wrong suggestion. please share if you find solution.
[eluser]@robertotra[/eluser]
Actually the url 'http//yoursite.ext/#/var1/var2' is equivalent to 'http//yoursite.ext/index.php#/var1/var2', because it refers to an anchor inside the index page. The problem is that the whole fragment part (the one after the sharp sign '#') is not even sent by http headers to the server, because it is meant to be used by the client browser to locate the internal anchor inside the document: that's why you cannot use the parse_url associative array to manage it (you should already have the full url to do so). The problem would seem apparently without solution unless you recognize that the anchor part can be retrieved by use of javascript inside the client browser: so you have to use AJAX to retrieve it and then push related content to the client. Cheers Roberto
[eluser]canado[/eluser]
yes everything after the # is clientside you need to do a js detection for that I did that for seo with flash, so I m redirecting in js to the same url without the #
|
Welcome Guest, Not a member yet? Register Sign In |