refresh page after 10 seconds javascript code example
Example 1: refresh page every second javascript
<script>
window.setInterval('refresh()', 10000);
// Call a function every 10000 milliseconds
// (OR 10 seconds).
// Refresh or reload page.
function refresh() {
window .location.reload();
}
</script>
Example 2: javascript refresh page every 30 seconds
setTimeout(function() {
location.reload();
}, 30000);
Example 3: javascript reload page one time
window.onload = function() {
if(!window.location.hash) {
window.location = window.location + '#loaded';
window.location.reload();
}
}