Skip to content

Instantly share code, notes, and snippets.

@RayBB
Created August 24, 2017 22:21
Show Gist options
  • Save RayBB/de8954ee5c4af2d8d63c08d469acf12b to your computer and use it in GitHub Desktop.
Save RayBB/de8954ee5c4af2d8d63c08d469acf12b to your computer and use it in GitHub Desktop.
Automatically updates any page every at whatever
var delay = 1; // seconds
var update = function(delay) {
var request = new XMLHttpRequest();
request.open('GET', window.location.href, true);
request.onload = function() {
document.body.innerHTML = this.response;
setTimeout(() => update(delay), (delay | 1) * 1000);
};
request.send();
};
update(delay);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment