How to stop iframe loading?

Hi, I am uploading a file through an iframe.

HTML:

<from action="upload.php" target="iframe"> <input type="file" name="file" /> <input type="submit" /> </form> <iframe name="iframe" src="javascript:false;"></iframe> 

Now I would like to stop loading at boot. So I would like to stop loading the iframe.

What i tried

$("iframe").attr("src", "javascript:false;");

$("iframe").remove();

 if (typeof(window.frames[0].stop) === "function") window.frames[0].stop(); else window.frames[0].document.execCommand("Stop"); 

All functions do not give an error, but after a while the file that I canceled was displayed in the download folder. So it's a weird thing.

Any suggestions?

+4
source share
2 answers

As long as you can destroy the iframe , any HTTP requests it made cannot be canceled. This is by design of HTTP.

The closest analogy is that it is trying to stop the bullet that you fired by destroying the gun.

+8
source

Try downloading flash files. They have many advantages from standard input, for example, for downloading multiple files, stopping the download queue, limiting file size, etc. Try the demo here: http://www.uploadify.com/demos/ , Of course they have a slightly complicated implementation.

-1
source

Source: https://habr.com/ru/post/1401000/


All Articles