PHP Location Header Ignore Hash [duplicate]
Possible Duplicate:
URL Fragment and 302 redirects
I am integrating Facebook login into my site. When Facebook redirects to my site with the code query parameter, there is a hash at the end http://myurl.com/code=xxx#_=_
When I then redirect from this url to another url at my site:
header('Location: http://myurl.com/home');
It keeps the hash tag and ends up as http://myurl.com/home#_=_
Is there a way to redirect without the hash or if anyone is familiar with Facebook a way to get it to stop adding 开发者_运维百科the hash in the first place?
You can redirect on your server side PHP to a URL that includes its own hash. That's what I had to do a ruby app that uses backbone.js.
PS - I specified the redirect_uri
and FB still appended the stupid #_=_
string :/
It seems JavaScript is the only way to remove a hash since the hash is never sent to the server in any way. So I added a script to a blank page:
window.location.hash = ''; window.location.href = "http://myurl.com"
This is the answer for now, but I will accept better ones.
精彩评论