Finally, I got a solution to reload the page after two months of research.
It works great on my JS client project.
I wrote a function that below reloads the page only once.
1) First time browser downloads
2) Get the current timestamp
3) Browser loading time + 10 seconds
4) If the browser loading time is 10 seconds longer than the current timestamp, the page can be refreshed using "reloadPage ();"
But if it does not exceed 10 seconds, it means that the page just reloads, so it will not reload again.
5) Therefore, if you call "reloadPage ();" A function somewhere on your js file page will be reloaded only once.
Hope this helps someone
// Reload Page Function // function reloadPage() { var currentDocumentTimestamp = new Date(performance.timing.domLoading).getTime(); // Current Time // var now = Date.now(); // Total Process Lenght as Minutes // var tenSec = 10 * 1000; // End Time of Process // var plusTenSec = currentDocumentTimestamp + tenSec; if (now > plusTenSec) { location.reload(); } } // You can call it in somewhere // reloadPage();
Mert Kadir GΓΌrsoy May 24 '18 at 14:11 2018-05-24 14:11
source share