Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
111
rated 0 times [  118] [ 7]  / answers: 1 / hits: 16890  / 11 Years ago, sat, july 20, 2013, 12:00:00

i need to stop loading my iframe page after 5000 ms i'm use these but it's refresh the iframe every 5000 ms later what the problem . pleas fix it pleas. thanks



<iframe id=iframe1 src= width=920 height=900 border=2></iframe>
<script type=text/javascript>
function setIframeSrc() {
var s = http://lx5.in/CGIT-Results-p2-2013.php;
var iframe1 = document.getElementById('iframe1');
if ( -1 == navigator.userAgent.indexOf(MSIE) ) {
iframe1.src = s;
setTimeout(setIframeSrc, 5000);
}
else {
iframe1.location = s;
setTimeout(setIframeSrc, 5000);
}
}
setTimeout(setIframeSrc, 5000);
</script>

More From » iframe

 Answers
35

To stop iframe loading you can use the following code based on this answer:



function setIframeSrc() {
var s = http://lx5.in/CGIT-Results-p2-2013.php;
var iframe1 = document.getElementById('iframe1');
iframe1.src = s;
setTimeout(function(){
if (window.stop) {
window.stop();
} else {
document.execCommand('Stop'); // MSIE
}
}, 5000);
}
setTimeout(setIframeSrc, 5000);


jsfiddle / jsfiddle/show


[#76862] Thursday, July 18, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dominics

Total Points: 424
Total Questions: 99
Total Answers: 107

Location: South Korea
Member since Fri, Sep 11, 2020
4 Years ago
dominics questions
Wed, Apr 6, 22, 00:00, 2 Years ago
Thu, Jan 13, 22, 00:00, 2 Years ago
Fri, Sep 18, 20, 00:00, 4 Years ago
;