PHP 位置标头忽略哈希值
可能的重复:
URL 片段和 302 重定向
我正在将 Facebook 登录集成到我的网站中。当 Facebook 使用代码查询参数重定向到我的网站时,末尾有一个哈希 http://myurl.com/code=xxx#_=_
然后,当我从这个网址重定向到我网站上的另一个网址时:
header('Location: http://myurl.com/home');
它保留哈希标签并最终为 http://myurl.com/home#_=_
有没有一种方法可以在不使用重定向的情况下进行重定向哈希值,或者如果有人熟悉 Facebook,有办法让它停止添加哈希值吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在服务器端 PHP 重定向到包含其自己的哈希值的 URL。这就是我必须做的一个使用backbone.js 的ruby 应用程序。
PS - 我指定了
redirect_uri
并且 FB 仍然附加了愚蠢的#_=_
字符串:/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 :/JavaScript 似乎是删除哈希值的唯一方法,因为哈希值永远不会以任何方式发送到服务器。所以我在空白页中添加了一个脚本:
这是目前的答案,但我会接受更好的答案。
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:
This is the answer for now, but I will accept better ones.