加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ajax – IE9 JSON数据到iframe:“你想打开还是保存这个文件?”

发布时间:2020-12-15 22:54:59 所属栏目:百科 来源:网络整理
导读:我有同样的问题 as is explained here,简而言之: 我正在使用iframe将文件发布到服务器AJAX样式,然后接收JSON响应以告诉我文件是否已成功上载和解析.除了IE9之外,每个浏览器都很棒.相反,IE9提示我保存或打开JSON,并且不会将其传递回iframe. 在另一个SO问题中
我有同样的问题 as is explained here,简而言之:

我正在使用iframe将文件发布到服务器AJAX样式,然后接收JSON响应以告诉我文件是否已成功上载和解析.除了IE9之外,每个浏览器都很棒.相反,IE9提示我保存或打开JSON,并且不会将其传递回iframe.

在另一个SO问题中,EricLaw -MSFT建议将内容类型设置为“application / json”,这是我所做的,但无济于事.

有谁知道如何让IE9让iframe拥有它的JSON?

解决方法

Well it looks like setting content type to “text/html” does the trick. It’s less than ideal since it’s not descriptive of the content,but oh well. Hope this helps someone else too.

HTML Forms are limited to sending data in three different content types: text/plain,application/x-www-form-urlencoded,and multipart/form-data

To workaround this issue,server code that currently processes HTML Forms must be rewritten to manually parse the request body into name-value pairs when receiving requests from XDomainRequest objects. This makes adding support for the XDomainRequest object more difficult than it would be otherwise.

参考

> XDomainRequest – Restrictions,Limitations and Workarounds
> HTML Living Standard: Association of controls and forms – The enctype and formenctype content attributes

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读