`
szgaea
  • 浏览: 213328 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

ie通过window.open下载excel,结果是直接打开excel乱码

阅读更多
    在应用中通过window.open(filename,'_self')下载excel时,变成直接在浏览器打开excel,而且还是乱码,在网上找了很多办法,如设置web.xml,在web.xml增加
 
 <mime-mapping> 
		<extension>xls</extension> 
		<mime-type>application/msexcel</mime-type> 
	</mime-mapping>

    也无效,最终找到一个办法,解决的这个问题,验证通过。解决的办法是:

 
 
  var w = window.open("","_self");
  w.location.href=fileUrl;

   通过以上代码,在ie中会弹出对话框,提示保存。







  作者:阿里巴巴taba
分享到:
评论
1 楼 JeffreyHsu 2011-08-31  
有用!!!

相关推荐

Global site tag (gtag.js) - Google Analytics