Hi to all, i would like make a script that detect if the page is full loading in 30 or else refresh the page with method (CTRL + F5) of Firefox that clear the cache of that page and refresh.. Is possibile to make? P.S: If is not possibile to make in Jquery i can use normal javascript. Thanks in advance. Kind Regards. Luca.
+5
A:
plain JavaScript
var loaded = false;
var time = 30000;
window.onload = function() {
loaded = true;
};
setTimeout(function() {
if(!loaded) {
window.location.reload();
}
},time);
jQuery
var loaded = false;
var time = 30000;
$(function() {
$(window).load(function() {
loaded = true;
});
setTimeout(function() {
if(!loaded) {
window.location.reload();
}
},time);
});
Ninja Dude
2010-09-12 17:01:58
You can also use `window.location.reload()`.
BalusC
2010-09-12 17:03:26
Thanks you,work perfectly :)
Luca
2010-09-12 17:53:20
A:
You can write this in your html head:
<meta id="meta-refresh" http-equiv="refresh" content="30; URL=(your url)">
It refreshes the page after 30 seconds. In your jQuery part there could be something like this:
$(window).load(function() {
$("#meta-refresh").remove();
});
elektronikLexikon
2010-09-12 17:03:07
Thanks you too,but i was need a function to add in a external script and in a page :-( Thanks you anyway ;-)
Luca
2010-09-12 17:54:04