micah1701 Posted December 28, 2010 Share Posted December 28, 2010 if the url is my-domain.com/some_page#here_is_an_anchor is there anyway to read that anchor value server side? parse_url() shows that it can parse the value, but the examples for that function are setting the value of the URL as a string, hard-coded into the script. I need to detect the URL dynamically. My suspicion is that this is impossible but I figured it can't hurt to ask. Thanks for any advice. Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted December 28, 2010 Share Posted December 28, 2010 to the best of my understanding, #anchors are not sent to the server. they are for use by the browser only. Quote Link to comment Share on other sites More sharing options...
micah1701 Posted December 28, 2010 Author Share Posted December 28, 2010 thanks for your input. Seems to firm up what I'm coming to realize, its just not possible. I have an ajax based page that loads content with javascript and simultaneously appends the url with a /#!/shebang tag to keep it SEO friendly with google. The only problem is, if JS isn't enabled, obviously the content can't load. I wish I could still use the anchor tag urls AND preload the content. Oh well. Guess its back to old fashioned ?variables=in_the_url Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted December 28, 2010 Share Posted December 28, 2010 what you're describing isn't an anchor, it is actually part of the url and can be grabbed. for instance, twitter picks up stuff after /#!/ in http://twitter.com/#!/SalonsOnline you can use mod_rewrite and/or PHP to redirect or passthrough based on whatever is after #! Quote Link to comment Share on other sites More sharing options...
micah1701 Posted December 28, 2010 Author Share Posted December 28, 2010 what you're describing isn't an anchor, it is actually part of the url and can be grabbed. for instance, twitter picks up stuff after /#!/ in http://twitter.com/#!/SalonsOnline you can use mod_rewrite and/or PHP to redirect or passthrough based on whatever is after #! well perfect. thats my question, how can php (or htaccess) get that value? i did a print_r($_SERVER) and don't see #! anywhere in there. Where can I get the value of the URL to parse server-side? EDIT: turn off javascript and try that link to twitter again. It doesn't redirect. They're using javascript to detect the hashbang in the URL and redirect the browser. Seems to indicate that this is still impossible Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted December 28, 2010 Share Posted December 28, 2010 oops, good call. i think you are correct; you can't get stuff after the #!. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.