I have a URL for product page like http://localhost:3000/product?page=1 and at the bottom of the page there is a button Load More. If we click that button, it will change the URL http://localhost:3000/product?page=2 (without reloading the page) and show the products for the page.
I want that if user refresh the browser and page>1 then user should redirect to page=1. i.e; We don't allow page refresh if page > 1
Basically, question is about to detect page reload.
I tried :
if (window.performance) {
if (PerformanceNavigationTiming.type == 1) {
alert( "This page is reloaded" );
} else {
alert( "This page is not reloaded");
}
}
But this did not work for me.
page>1in url and user refresh the browser or manually enteredhttp://localhost:3000/product?page=2, then user should redirect to page=1".Load More. If we click that button, it will change the URL for the next pagehttp://localhost:3000/product?page=2(without reloading the page)