`
tcw290
  • 浏览: 21542 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

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

阅读更多

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中会弹出对话框,提示保存。

http://www.myexception.cn/web/787903.html

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics