JSFiddle - React, Tailwind, and code Playground
by HYEONGJINKIM
JavaScript
document.addEventListener("backbutton", function(e){
alert("backbutton");
}, false);
window.onpopstate = function (evt) {
// Android hack. After printing location and state, I can read the state. Not before.
var triggerCheck = "location: " + document.location + ", state: " + JSON.stringify(evt.state);
//check evt.state if its previous url or not then do your thing
alert(triggerCheck);
};
document.addEventListener("onunload", function(e){
alert("onunload");
}, false);