0 0

dwr callback 文件下载框被拦截20

function exportList(txtOrExcel){  
    dwr.engine.setAsync(false);   
    ClientGroupMgmt.exportUsers(listId_exp, function(fileName) {  
         window.open("<%=request.getContextPath()%>/common/ftpdownloadByFileName.jsf?fileName="+fileName);  
        });  
    dwr.engine.setAsync(true); 

之前以为说前后加上dwr.engine.setAsync(...);就可以下载了,我自己的机器小数据量的有试过可以。
现在在别人的机器上,一用到dwr.engine.setAsync(false);  这句,浏览器都卡住了,甚至死机...

请问怎么处理?谢谢








--------------------------------------------
DWR 
2010年12月15日 14:05

2个答案 按时间排序 按投票排序

0 0

采纳的答案

function exportList(txtOrExcel){   
    dwr.engine.setAsync(false);
    var file;
    ClientGroupMgmt.exportUsers(listId_exp, function(fileName) {   
     file = fileName;       
        }); 
window.open("<%=request.getContextPath()%>/common/ftpdownloadByFileName.jsf?fileName="+file);  
    dwr.engine.setAsync(true); 
}

因为在回调函数里触发相当于服务器触发,会被浏览器认为是恶意的所以被拦截。

2010年12月28日 10:25
0 0

试试类似这样的写法:
    downloadTemple:function(type){
    if (window != top) {
    top.location.href = 'DownloadSvt?dlType='+type;
    } else {
    location.href = 'DownloadSvt?dlType='+type;
    }
    },
如果还是有问题, 建议下载不要再dwr callback方法中做.

2010年12月15日 17:03

相关推荐

Global site tag (gtag.js) - Google Analytics