本文介绍了是否可以取消使用隐藏 iframe 的文件上传?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Is it possible to cancel file upload that uses hidden iframe?
I've tried to set source of iframe to empty string, but upload haven't been interrupted.
解决方案
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 的文件上传?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!