The Most Active and Friendliest
Affiliate Marketing Community Online!

“AdsEmpire”/  Direct Affiliate

Back Button Redirect Script (Chrome)

Daniel Hegner

New Member
affiliate
Hi guys,

I implemented several back button redirect scrips on my landers.

They all work fine, except on chrome. Does chrome block this kind of "sneaky" scripts?

And if so, is there a script that still works in the google chrome browser?

Thanks in advance! :)
 
Try this one.
HTML:
<script type = "text/javascript">
(function(window, location) {
    var base=document.getElementsByTagName('base');
    var hasBase = base.length==1;
    var baseHref='';
    if (hasBase){
        baseHref = base.href;
        base[0].remove();
    }
    history.replaceState(null, document.title, location.pathname+"#!/stealingyourhistory");
    history.pushState(null, document.title, location.pathname);
    if (hasBase){
        var newbase = document.createElement('base');
        newbase.href = baseHref;
        document.head.appendChild(newbase);
    }

    window.addEventListener("popstate", function() {
      if(location.hash === "#!/stealingyourhistory") {
            history.replaceState(null, document.title, location.pathname);
            setTimeout(function(){
              location.replace("https://google.com");
            },0);
      }
    }, false);
}(window, location));
</script>
 
Try this one.
HTML:
<script type = "text/javascript">
(function(window, location) {
    var base=document.getElementsByTagName('base');
    var hasBase = base.length==1;
    var baseHref='';
    if (hasBase){
        baseHref = base.href;
        base[0].remove();
    }
    history.replaceState(null, document.title, location.pathname+"#!/stealingyourhistory");
    history.pushState(null, document.title, location.pathname);
    if (hasBase){
        var newbase = document.createElement('base');
        newbase.href = baseHref;
        document.head.appendChild(newbase);
    }

    window.addEventListener("popstate", function() {
      if(location.hash === "#!/stealingyourhistory") {
            history.replaceState(null, document.title, location.pathname);
            setTimeout(function(){
              location.replace("https://google.com");
            },0);
      }
    }, false);
}(window, location));
</script>

I tested it today:
  • working on chrome 87.0.4280.88 ONLY AFTER interaction with page (like a click on a popup at the beginning)
  • working on ff 83.0 OK
  • working on edge 87.0.664.55 ONLY AFTER interaction with page (like a click on a popup at the beginning)
 
hijacking the back button on browsers leads to problems --in fact that may make the website to be classified a "hostile" --good luck
 
banners
Back