Home > Technical & Creative Skills > Programming, Servers & Scripts

Chrome update kills back button... (22)


01-31-2019 08:01 AM #1 guesswho (Member)
Chrome update kills back button...

Hello!
As you may see chrome update killed back button redirect. Are there any new solutions yet to keep this feature?


01-31-2019 08:22 AM #2 thedudeabides (Moderator)

Just updated and checked. Still working for me on desktop and mobile.


01-31-2019 08:43 AM #3 codeflame ()

don`t shock me in the morning with wrong news^^

its still working fine!
maybe just the way you was using it didn`t work any longer ;-)


01-31-2019 08:51 AM #4 mrbraun (Moderator)

Hey!

Yes, for me it works as well.
May be you can share with is your script if it doesn't work?


01-31-2019 08:56 AM #5 guesswho (Member)

it's weird... It is not working on my mobile (iphone app updated) but it still works on the desktop (also freshly updated).

I am using this script:
<script>
history.replaceState(null, document.title, location.pathname+"#!/redirect.php");
history.pushState(null, document.title, location.pathname);
window.addEventListener("popstate", function() {
if(location.hash === "#!/redirect.php") {
setTimeout(function(){
location.replace("MYURL");
},0);
}
}, false);
</script>


03-27-2019 10:42 PM #6 onlymine (Member)

Can someone confirm this is working on mobile chrome? If so what exit pop script are they using. I saw this one Matuloo posted on his blog

1. Step : Copy this code into the Landing Page, you can put it in the <head> </head> part of the source code. This is a simple html version, it works even on a CDN.

<script>
function init() {
setTimeout(function(){window.scrollTo(0,1)},0);
}

window.history.pushState(‘back.html’, ‘back’, ‘back.html’);
window.history.pushState(‘index.html’, ‘Index’, ‘index.html’);
window.addEventListener(“popstate”, function(e) {
if(document.URL.indexOf(“back.html”) >= 0){
document.location.href = document.location;
}

});
</script>

2. Step: Create a back.html file and put it in the same directory as the LP. Copy the code below into the back.html file.

<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<script>

document.location.href = “http://redirecturl.com”;

</script>
</head>
<body>
</body>
</html>


03-28-2019 03:22 AM #7 affiliatecase (Member)

Hey, I wrote an article recently with the working code. Been using that for quite some time now. It works.

https://www.affiliatecase.com/back-button-redirect/

Code:
<script>
history.pushState(null, null, document.location);
window.addEventListener(‘popstate’, function () {
window.location=”https://www.yourtargeturl.com”;
});
</script>


03-29-2019 03:12 PM #8 mylead (Senior Member)

Actually it's working for me still, try to turn off extension, sometimes it's getting chrome bugged.


05-14-2019 01:33 PM #9 leon davinci (Member)

what do you think about this?

https://nakedsecurity.sophos.com/201...r-back-button/


06-22-2019 09:01 PM #10 chinopaisa (Member)

Quote Originally Posted by affiliatecase View Post
Hey, I wrote an article recently with the working code. Been using that for quite some time now. It works.

https://www.affiliatecase.com/back-button-redirect/

Code:
<script>
history.pushState(null, null, document.location);
window.addEventListener(‘popstate’, function () {
window.location=”https://www.yourtargeturl.com”;
});
</script>
Hi @affiliatecase, I tried putting this code in my lander, but it still didn't seem to work. I tried for both the <header> and <body> sections, and neither worked.

Did this stop working in the time you posted this, or am I doing something wrong?


07-25-2019 11:07 AM #11 guesswho (Member)

Hi all,

Anyone found solution maybe? Script works for desktop (one condition - user must interact with website) but mobile seems to be completely dead... Any tricks to manipulate user interaction?


07-25-2019 09:57 PM #12 micoangelo (Member)

Quote Originally Posted by affiliatecase View Post
Hey, I wrote an article recently with the working code. Been using that for quite some time now. It works.

https://www.affiliatecase.com/back-button-redirect/

Code:
<script>
history.pushState(null, null, document.location);
window.addEventListener(‘popstate’, function () {
window.location=”https://www.yourtargeturl.com”;
});
</script>

Beautifully simple


07-27-2019 12:02 PM #13 maelstrom (Member)

At this moment everything dead for me. So, contacted my friends who are lead developers/managers in few huge affiliate networks. Maybe they will solution for the last update.


11-18-2019 12:09 AM #14 jdj1111 (Member)

Does anyone have a back button redirect script that works for both desktop and mobile? I've tried several that I've found on this forum, but if they do work, they only work on desktop.


11-18-2019 12:20 AM #15 elprofesor (Member)

Since Chrome 75, Google is binding write access to the browser history API to a trusted user event. So you need to update your script for this. It's still possible.


11-18-2019 02:28 AM #16 ianternet (Senior Member)

here is a code I use - seems to still work on my landers

HTML Code:
<script type=”text/javascript”>
! function () {
var t;
try {
for (t = 0; 10 > t; ++t) history.pushState({}, “”, “#”);
onpopstate = function (t) {
t.state && location.replace(“https://URLHERE”)
}
} catch (o) {}
}();
</script>


11-18-2019 07:52 AM #17 erikgyepes (Moderator)

Back button in Chrome Mobile still works, but you need to make some interaction with the lander first otherwise it will just go back to previous page.

Things users can do:
- click OK on a small modal window/popup
- answer a question on a quiz lander
- open envelope/box, click the lucky wheel etc.

Just make your lander appealing enough, so they want to interact in.

After that back button script will kick in and work properly.


11-18-2019 08:18 AM #18 eurosen (AMC Alumnus)

I think it might be possible to automatically trigger user interaction on page load using a script in the header?


11-18-2019 01:27 PM #19 elprofesor (Member)

Also, it's important to know that the history API has legit uses. I.e. for SPAs written in React or similar libraries. You just need a trusted event like Erik pointed out above(test many, doesn't have to be a click even), and hit the history API, and your backbutton script will be good as gold ...


11-18-2019 01:48 PM #20 sushiparlour (Member)

The newer browsers don't let you redirect to an external domain. E.g. if your page is www.mypage.com/index.html then you can't get the page to redirect to www.youtube.com but you can get it to redirect to www.mypage.com/aboutus.html beacuse it uses the same domain and if you're creative you can get it to go wherever you want. You can check out @matuloo's blog that covers it: http://www.matuloo.com/maximize-your...ript-included/


11-18-2019 02:48 PM #21 elprofesor (Member)

In that case you can just append a # and do a js redirect if url contains #, or a file on same domain with a meta refresh or header redirect ... but I know for sure for "future proofness", you want to hook it into an event. You can even use this to optimize and remove shit traffic. I.e. at the same time you hook in the BB, you can fire a js event to your tracker and you can see which placements lead to interactions, and which don't.


11-18-2019 08:10 PM #22 jdj1111 (Member)

Thanks very much for your insights everyone.

It turns out that I was immediately trying to press the back button without first interacting with the site. If I interact with the site first, it works fine.


Home > Technical & Creative Skills > Programming, Servers & Scripts