Reputation: 184
I've created a loop in JS and have a condition that say if(minute === 15), once the clock hits 15mins past (whatever) the condition is met.
I want to make that "15" a variable that can be changed from another webpage.
website.com/alarm Contains the loop
website.com/alarmConfig Contains a text field used to set the minute.
I originally was going to make that script read a notepad that has the value in it, but because the page will be running on a range of devices I need those browsers to be able to do that.
What would be the simpliest way of doing this? Doesn't need to be in real-time
Upvotes: 0
Views: 66
Reputation: 152
You can make an Ajax call to "website.com/alarmConfig" webpage and then retrieve the value of the text field used to set the minute and then update the loop in "website.com/alarm". Also, you will make the call after the said duration is over and once you retrieve the updated value, you can run the loop again.
Upvotes: 0
Reputation: 5214
You can't do it. But you can use cookies or localStorage to share these variables.
For simple synchronous storage access HTML 5 introduces the localStorage attribute on the Window object:
localStorage["status"] = "Idling.";
Upvotes: 1