The problem with your code is, you are invoking the function instead of passing it to be called after the time interval. If you need to pass the function, just pass the name of the function. Putting the parentheses is actually invoking the function which will happen right away the moment you set the setInterval
If you want to reload your page every 10 seconds, you can simplify it a bit. I don't see any reason why you should have setInterval in this case. I think this is sufficient and should work
// After 10s, run the function
setTimeout(function() { window.location.reload(false)},10000)
You might want the 10s counted after all the DOM is ready.
var fn = function() {
setTimeout(function() { window.location.reload(false)},10000);
}
// Note that, I pass the function name instead of invoking it with fn()
document.addEventListener('DOMContentLoaded', fn)
The reason why I am using setTimeout instead of setInterval is, it will only run once per session and will be refreshed. I think it should be sufficient.