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

余生颓废 提交于 2019-11-30 19:01:40

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

Try this:

iframe.contentWindow.stop(); //for anything but IE
iframe.contentWindow.document.execCommand("Stop"); // for IE

Currenty setting iframe src to "javascript:false" works for me.

I'm not sure but i guess removing the iframe from the dom should be enough?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!