IE9 JSON数据“您要打开还是保存此文件"? [英] IE9 JSON Data "do you want to open or save this file"

查看:314
本文介绍了IE9 JSON数据“您要打开还是保存此文件"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

开始使用IE9测试我的jQuery应用程序.看来我可能在这里遇到了一些麻烦. 我注意到,当我将JSON数据返回给Javascript方法时,总是得到如下提示:您要打开还是保存该文件?"并为我提供3个按钮:打开",保存"和取消".当然,我的JavaScript会根据JSON对象中设置的值执行操作,但是由于IE9不会将其传递给脚本,因此我无法从那里开始执行后续操作.

Started testing my jQuery applications with IE9. Looks like I may be in for some trouble here. I noticed that when I return JSON data back to the Javascript methods I always get this Prompt that says: "Do you want to open or save this file?" and provides me with 3 buttons: Open, Save and Cancel. Of course, my javascript is taking actions based on the values set in the JSON object but since IE9 doesn't pass it over to the script, I cannot execute the follow up action from there on.

还有其他人面临这个问题吗?这是快照.

Anyone else facing this issue? Here is a snapshot.

推荐答案

实际上,您说对了@EricLaw.在Json结果中设置内容类型后,它就可以了. 我必须添加以下几行:

Actually, you were right @EricLaw. After setting the content type in the Json result, it worked. I had to add the following lines:

 result.ContentEncoding = System.Text.Encoding.UTF8; 
 result.ContentType = "application/json; charset=UTF-8

这篇关于IE9 JSON数据“您要打开还是保存此文件"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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