标题位置通过锚标记和IE7重定向 [英] header Location redirect with anchor tag and IE7
问题描述
嘿!这是我的问题,它可能只是一个浏览器问题,但任何帮助/想法都会很棒!
几乎我有以下重定向:
header(Location:page.php#images);
在大多数现代浏览器中,它将重定向到page.php#图像,但没有任何问题,但在IE中似乎去除#图片。有没有人遇到过这个?到目前为止,我唯一的选择就是通过JavaScript重定向。
p> 更新我发送了一个简单的沙盒,它似乎可以在使用或不使用绝对URL时正常工作。我想在我的实际应用程序中还有其他事情与它发生冲突。我会在更新的时候进行更新,谢谢所有回复!
UPDATE 2
我发现问题是什么,但我仍然不确定这个问题。事实证明,这是一个打破它的文件输入。你可以在这里看到它的作用 http://www.stiprojects.com/anchor/ 它的工作原理罚款在Firefox中,但在IE浏览器中断。重定向中的源代码是:
标题(位置:http://www.stiprojects.com/anchor/index .PHP一个= 1&安培; 2 = 2#/图像);
您是否看到我没有看到的东西?我很困惑!
http://example.org/a_redirector#this
其中 a_redirector
重定向到 http://example.com/destination#that
)未定义。
Hey there! Here is my issue, it could just be a browser issue but any help/ideas would be awesome!
Pretty much I have the following redirect:
header("Location: page.php#images");
In most modern browsers it will redirect to page.php#images without any problems but in IE it seems to strip the #images. Has anyone come across this? So far my only option (which I think is a terrible option) is to redirect through JavaScript.
thanks!
UPDATE
I sent up a simple sandbox and it seems to work fine with or without an absolute URL. I guess there is something else going on in my actual app that is conflicting with it. I'll update when I figure it out, thanks for all the responses!
UPDATE 2
I found out what the problem is but I am still unsure on the fix. It turns out that it was a file input that was breaking it. You can see it in action here http://www.stiprojects.com/anchor/ it works fine in firefox but breaks in IE. the source code in the redirect is:
header("Location: http://www.stiprojects.com/anchor/index.php?one=1&two=2#/images");
Do you see anything that I'm not seeing? I'm so confused!
The Location
header requires an absolute path per the HTTP specification. Try using an absolute path. The errata says that document fragments (#id) are allowed in the Location header, but the behaviour when a user is linked to a page with a fragment (e.g. http://example.org/a_redirector#this
where a_redirector
redirects to http://example.com/destination#that
) is undefined.
这篇关于标题位置通过锚标记和IE7重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!