超链接在重定向后停止在Firefox中工作? [英] Hyperlinks stop working in firefox after redirect?

查看:178
本文介绍了超链接在重定向后停止在Firefox中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我正在进行的项目中,我使用HTTP标头在成功登录后将用户重定向到首页;

  header(Location:http://example.com/index.php?); 
exit(0);

编辑:为网址添加问号以显示问题



在所有测试过的浏览器中都能正常工作 - 但是,在Firefox 3.0.6中,无论是在windows,mac还是debian,都无法正确设置超链接。每个超链接指向重定向指向的同一个URL,完全忽略 href 属性。刷新页面并没有帮助 - 我必须手动重新输入URL,然后按超级链接的回车重新开始工作。

我已经在IE6,IE7,Opera和Safari中试过了,它工作正常。我假设我实现重定向的方式有问题,任何人都可以指向正确的方向吗?

解决方案似乎是这样的:
我不能重定向到以questionmark结尾的网址,如果我这样做,会出现这个问题。在我看来,这不是FF3的预期行为,但我不知道HTTP规范是否足以说明情况。



无论哪种方式,通过从重定向网址删除问号解决问题。

On a project I'm working on, I am using HTTP headers to redirect the user to the frontpage after a successful login;

header("Location: http://example.com/index.php?");
exit(0);

EDIT: Added questionmark to url to show the problem

This works fine in all browsers tested - however, in Firefox 3.0.6, both on windows, mac and debian, it fails to set the hyperlinks properly. Every single hyperlink points to the same URL the redirect points to, completely ignoring the "href" attribute. Refreshing the page does not help - I have to re-enter the URL manually and hit enter for the hyperlinks to start working again.

I've tried this in IE6, IE7, Opera and Safari, and it works fine. I'm assuming something is wrong with the way I implement the redirect, could anyone point me in the right direction?

解决方案

The solution seems to be this: I cannot redirect to a url ending with a questionmark, if I do, this problem will occur. It would seem to me this is not expected behavior from FF3, but I don't know the HTTP-spec's well enough to say if that's the case.

Either way, problem solved by removing question-mark from redirect url.

这篇关于超链接在重定向后停止在Firefox中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆