是否有可能取消文件上传使用隐藏的iframe? [英] Is it possible to cancel file upload that uses hidden iframe?

查看:113
本文介绍了是否有可能取消文件上传使用隐藏的iframe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能取消文件上传使用隐藏的iframe?

Is it possible to cancel file upload that uses hidden iframe?

我试图设置iframe的源空字符串,但上载并没有中断。

I've tried to set source of iframe to empty string, but upload haven't been interrupted.

推荐答案

iframe的是自带的形式发布的传输信道,所以阿塔纳斯是正确的,你必须停止在iframe内的运输。

the iframe is the transport channel that is carrying the form posting, so Atanas is correct, you have to stop the transport inside the iframe.

下面是依赖于浏览器做的一种方式:

here is a way of doing it depending on browser:

if (iframeObj.contentWindow.document.execCommand)
    { // IE browsers
        iframeObj.contentWindow.document.execCommand('Stop');
    }
else
    { // other browsers
        iframeObj.contentWindow.stop();
    }
// notify user upload was cancelled, remove spinner images, etc

这篇关于是否有可能取消文件上传使用隐藏的iframe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆