Created
September 8, 2015 20:05
-
-
Save mortenson/1ef6d409f05523865aed to your computer and use it in GitHub Desktop.
Refresh current path in JS every 5 seconds (try it out by editing the content of body)
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
<html> | |
<head> | |
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script> | |
<script> | |
$(function() { | |
if (typeof init === 'undefined') { | |
init = true; | |
setInterval(function () { | |
$.get('', function (data) { | |
var doc = document.open('text/html', 'replace'); | |
doc.write(data); | |
doc.close(); | |
}); | |
}, 5000); | |
} | |
}); | |
</script> | |
</head> | |
<body> | |
Hello world. | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment