Deviate BrowserBack

If on a web page clicking BrowserBack does no good, BrowserBack shall be deviated for doing good.

Example

  1. Go to
  2. Click the "swiss directory" link (you'll find it in the Address Aid section near the address textarea)
  3. 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
  4. 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);

Download

Content Management System u5CMS

Service

English⇄German Translation Service

Flowers

blumen-bern-maarsen.ch