通过ifrmae异步下载文档

//通过ifrmae异步下载文档
function iframeGetFile(opts) {
    var defaultOpts = {
        filePath: '',
        onload: function (e) { }
    }, iframeFile;
    $.extend(defaultOpts, opts);
    iframeFile = document.createElement("iframe");
    iframeFile.onload = function (e) {
        defaultOpts.onload.call(this, e);
        $(iframeFile).remove();
    }
    iframeFile.src = defaultOpts.filePath;
    iframeFile.style.cssText = "display:none;";
    document.body.appendChild(iframeFile);
},

调用:

$.iframeGetFile({ filePath: requestUrl + "?" + strOptions });

posted @ 2017-05-17 12:02  欧欧欧锋_  阅读(217)  评论(0编辑  收藏  举报