Basically I need quite (probably) a simple thing check if 5 minutes passed after script load.
Script structure should be like this:
var check;
check = 300; //5 minutes
if ( count to 300 seconds >= check) {
//do magic
} else {
}
Basically I need quite (probably) a simple thing check if 5 minutes passed after script load.
Script structure should be like this:
var check;
check = 300; //5 minutes
if ( count to 300 seconds >= check) {
//do magic
} else {
}
Simply save the time when the load
event has been triggered and then check against it.
var loadTime;
window.onload = function() {
loadTime = (new Date().getTime()) / 1000; // convert milliseconds to seconds.
};
// your code
var currentTime = (new Date().getTime()) / 1000;
if (currentTime - loadTime >= 300) {
// then more than 5 minutes elapsed.
}
The easiest and simplest way could be this:
setTimeout(function(){
// do stuff
}, 300 * 1000); // time in milliseconds