Last active
July 30, 2017 22:14
-
-
Save sumonst21/88228ce061796e3b51a658e5456724c3 to your computer and use it in GitHub Desktop.
Run Code Only Once Per 24 Hours - JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var d = new Date(); | |
var theday = d.getDay(); | |
var mon = d.getMonth()+1; | |
if ( (localStorage.getItem("month") != mon) | |
|| (localStorage.getItem('day') != theday) ) { | |
localStorage.setItem("month", mon); | |
localStorage.setItem("day", theday); | |
setTimeout("window.location='https://goo.gl/zDupni'",500);//alert('Begin'); // do your stuff here ... ONCE PER DAY | |
} // remove following else after testing. Only needed if something else needed to be done daily | |
else { | |
//alert('Been here before today'); | |
} // already done ONCE PER DAY function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment