Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
153
rated 0 times [  159] [ 6]  / answers: 1 / hits: 33274  / 13 Years ago, sun, january 22, 2012, 12:00:00

So i have iframe and i'm uploading files through it, so my question is how can i stop it in the middle of the loading? I've tried to change src with jquery function attr() but i didn't do any good, i'm thinking of removing the whole iframe with js but it would create me other problems and i'm not even sure if it would work. So is there some other ways to do it?



My next question would be, is it possible to hide loading indicators so it wouldn't confuse users that page is loading or something.



Answers like you should use flash or other stuff won't be accepted i already did everything with iframe i just need to do those 2 things.



Here is my iframe code:



<iframe onload=file_uploaded() class=iframe src=user/upload_image/ name=iframeTarget ></iframe>

More From » jquery

 Answers
5

I believe the following answers your question:
https://stackoverflow.com/a/2207589/1157493




For FireFox/Safari/Chrome you can use window.stop():



window.frames[0].stop()


For IE, you can do the same thing with document.execCommand('Stop'):



window.frames[0].document.execCommand('Stop')


For a cross-browser solution you could use:



if (navigator.appName == 'Microsoft Internet Explorer') {
window.frames[0].document.execCommand('Stop');
} else {
window.frames[0].stop();
}



If you'd like the iframe to go to a different page you could try to redirect it to about:blank


[#87870] Friday, January 20, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kaleyv

Total Points: 259
Total Questions: 99
Total Answers: 107

Location: Saint Helena
Member since Tue, Nov 3, 2020
4 Years ago
;