![](/img/trans.png)
[英]IE8's information bar blocking a scripted file download in response to JQuery AJAX request
[英]IE8 jquery json response triggers download
我希望IE8使用以下可返回ajax请求作为json的jquery:
$.ajax({
url: formAction,
type: 'post',
dataType: 'json',
data: form,
success: function(data) {
closeBlocker();
if (data.count != 0) {
$('#divid').toggle('slow');
} else {
$("#anotherdiv").css('display', 'none');
}
processSearchResult(target, data);
reloadMap(data);
}
});
在所有其他浏览器中,这会触发调用以获取数据。 但是,在IE8中,这会弹出一个对话框,询问用户是否要下载文件。 看起来像这样:
我看到了这篇文章,但还没有能够正确更改ContentType。
如何在IE8中做同样的事情而不影响其他浏览器? 感谢您的想法!
我想这与MIME类型有关 。
您必须告诉浏览器将其视为text / html。 然后它将不会尝试下载它,而是将其显示为文本。
为此,您可以在标头中发送Content-type = "text/html"
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.