I want to make a page that redirects users when they reload the page clicking the browser icon or F5, but not when they open the page. Is it possible?
Thanks in advance.
I want to make a page that redirects users when they reload the page clicking the browser icon or F5, but not when they open the page. Is it possible?
Thanks in advance.
Apparently I don't have enough reputation to comment yet, so I will just link to another post here that should give you the solution you are looking for: Check if page gets reloaded or refreshed in Javascript
So based on that answer, you just do something like this...
//check for Navigation Timing API support
if (window.performance) {
console.info("window.performance works fine on this browser");
}
if (performance.navigation.type == 1) {
console.info( "This page is reloaded" );
window.location = "/redirect_url"; // The url you want
} else {
console.info( "This page is not reloaded");
}