利用隐藏 iframe 下载文件

时间:2021-12-02 09:56:45

 

  1. 在开发项目中遇到问题:下载文件后台报错,下载文件的页面会出现空白或异常信息,需要解决。

    利用隐藏 iframe 下载文件
  2. 解决方法:利用隐藏iframe下载文件

 利用隐藏 iframe 下载文件

  3:对于a标签,采用target属性方法

 <a target="downfile" data-bind="attr:{href:getDownFilePath( templateFileName,outFileName,taskId)}">下载</a>

  

      对于button,添加click事件  

page.export=function(){
var url="/lsjzjn/RecordResultMgr/getExport?storeId="+data.models.model.storeId()+"&instanceId="+$.getQueryString("instanceId");
document.getElementsByName('downfile')[0].src=url;
}