Deviate BrowserBack
If on a web page clicking BrowserBack does no good, BrowserBack shall be deviated for doing good.Example
- Go to
- Click the "swiss directory" link (you'll find it in the Address Aid section near the address textarea)
- Now a fly-in container is rendered that COULD be moved to the left by clicking the aside-link (in this container's top right corner). BUT DON'T DO IT
- Instead, click BrowserBack. You will now see, that BrowserBack does not go to the previous web-page, much better, it is clicking the above mentioned aside-link.
How to deviate Browserback
// managage back button click (and backspace)
var count = 0; // needed for safari
window.onload = function () {
if (typeof history.pushState === "function") {
history.pushState("back", null, null);
window.onpopstate = function () {
history.pushState('back', null, null);
if(count == 1){YOURCODE}
};
}
}
setTimeout(function(){count = 1;},200);