IE不遵循重定向,给出“Internet Explorer无法显示网页”。 [英] IE doesn't follow redirect, gives "Internet Explorer cannot display the webpage"

查看:172
本文介绍了IE不遵循重定向,给出“Internet Explorer无法显示网页”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含几个字段的表单。提交表单时,服务器将使用重定向进行响应(HTTP 302)。

I have a form with a few fields. When you submit the form, the server responds with a redirect (HTTP 302).

提交表单时,如果有< input type = file> 字段,IE不会'请遵循重定向,但却出错:Internet Explorer无法显示网页。

When the form is submitted, if there is an <input type=file> field, IE doesn't follow the redirect, but instead gives an error: "Internet Explorer cannot display the webpage".

如果 < input type = file> 字段,然后它按照预期重定向。

If there is no <input type=file> field, then it does follow the redirect as expected.

HTTP 302响应在这两种情况下完全相同,只是区别于响应的时间戳。

The HTTP 302 Response is exactly the same in both cases, differing only by the timestamp of the response.

我在IE8和IE9中遇到过这种情况。 (我没有尝试过较低版本)。 Firefox,Chrome,Opera和Safari都按照预期重定向。

I'm experiencing this in IE8 and IE9. (I haven't tried lower versions). Firefox, Chrome, Opera and Safari all follow the redirect as expected.

注意:


  • 表单的属性为 enctype =multipart / form-data

  • 这是通过SSL发生的

  • 重定向不是与表单POST或托管在其上的URL不同的协议,主机或端口。

  • 当我检查HTTP流量时 Fiddler2 ,问题消失,IE表现出色。

  • The form has the attribute enctype="multipart/form-data".
  • This is happening over SSL
  • The redirect is not to a different protocol, host, or port than the URL the form POSTs to or is hosted on.
  • When I inspect HTTP traffic with Fiddler2, the issue disappears and IE behaves.

推荐答案

您是重定向到部分URL还是完整的URL(包含主机,协议等)?我在PHP中看到很多示例,其中302的重定向没有完整的 http://server.dom/path/to其中的/ file 将被IE忽略或破坏。在Rails中,这可能是路由器中foo_path和foo_url之间的区别。

Is your redirect to a partial URL or a complete URL (with host, protocol, etc.)? I have seen plenty of examples in PHP where a redirect with 302 that does not have a complete http://server.dom/path/to/file in it will be ignored or mangled by IE. In Rails, this can be the difference between foo_path and foo_url in the router.

这篇关于IE不遵循重定向,给出“Internet Explorer无法显示网页”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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