So im figuring out a way on how to redirect my page to another page when i hit the refresh button on my chrome but can't seem to find how to do it using JavaScript.
function confirmExit() {
alert("exiting");
window.location.href = "index.html";
return true;
}
window.onbeforeunload = confirmExit();
When i use this code it just infinite loop.