I have two different processes below. One listens for backwards or forwards in the browser, and the other listens for a refresh.
They work separately. I want to combine these two processes into one if
statement that shows either one can happen for a process to follow.
I tried different ways to combine them with ||
but that doesn’t work. I tried saving them in variables, and it does not work. Any ideas?
//LISTEN FOR ANY NAVIGATION CHANGE, FORWARD, BACKWARD, OR REFRESH
window.navigation.addEventListener("navigate", (event) => {
alert('User Navigated');
});
if (performance.navigation.type == performance.navigation.TYPE_RELOAD)
alert ('User Reloaded the Page');
{