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

由网友(姐有姐的feel)分享简介:是否有可能取消文件上传使用隐藏的iframe?Is it possible to cancel file upload that uses hidden iframe?我试图设置iframe的源空字符串,但上载并没有中断。I've tried to set source of iframe to empty st...

是否有可能取消文件上传使用隐藏的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
阅读全文

相关推荐

最新文章