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. Link to comment https://forums.phpfreaks.com/topic/222825-can-php-read-fragments-after-hashmark-anchor-from-url/ 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. Link to comment https://forums.phpfreaks.com/topic/222825-can-php-read-fragments-after-hashmark-anchor-from-url/#findComment-1152155 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 Link to comment https://forums.phpfreaks.com/topic/222825-can-php-read-fragments-after-hashmark-anchor-from-url/#findComment-1152233 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 #! Link to comment https://forums.phpfreaks.com/topic/222825-can-php-read-fragments-after-hashmark-anchor-from-url/#findComment-1152235 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 Link to comment https://forums.phpfreaks.com/topic/222825-can-php-read-fragments-after-hashmark-anchor-from-url/#findComment-1152247 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 #!. Link to comment https://forums.phpfreaks.com/topic/222825-can-php-read-fragments-after-hashmark-anchor-from-url/#findComment-1152285 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.