I find the back button as follows:
window.onload = function () { if (typeof history.pushState === "function") { history.pushState("jibberish", null, null); window.onpopstate = function () { history.pushState('newjibberish', null, null);
This works, but I have to create a cookie in Chrome to detect that I first got to the page, because when I enter the page without control with the cookie, the browser does the opposite without clicking any button.
if (typeof history.pushState === "function"){ history.pushState("jibberish", null, null); window.onpopstate = function () { if ( ((x=usera.indexOf("Chrome"))!=-1) && readCookie('cookieChrome')==null ) { addCookie('cookieChrome',1, 1440); } else { history.pushState('newjibberish', null, null); } };
}
AND VERY IMPORTANT, history.pushState("jibberish", null, null); duplicates browser history.
Does anyone know who can fix this?
Alexandra Jan 21 '14 at 16:56 2014-01-21 16:56
source share