I need to be able to detect if the user refreshed the window or navigated away (say google.com) and then return to the page so I can trigger an event.
I tried different onbeforeunload but it wasnt detecting it.
I tried, this and it wasnt working or triggering the console.log.
componentDidUpdate()
{
window.addEventListener("onbeforeunload",function (){
console.log('Page Refreshed')
})
}
However, that doesnt even trigger the console.log message. I have also tried beforeunload and same results
any ideas why?