Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

66
Views
JavaScript triggered redirect not working on site opened in facebook webview

Opening our ecommerce site from within the Facebook app on Android, opens the page itself in a Facebook web view. When performing the purchase, an external app is opened for digital identification, and the user then has to return to the Facebook web view. Upon returning to Facebook - the user should be redirected to a thank you page.

This works fine in iOS. However - in some Android phones this doesn't work. The hypothesis is that the Facebook web view blocks programmatically initiated redirects, since putting the url in a link clicked by the user works fine.

The issue is recreated in Pixel with Android 12 and Facebook app, however the redirect works in some other web view apps on the same phone making Facebook app a suspect.

Different redirect approaches that has been tested with and without delays:

//1
document.location = url;

//2
window.location.replace(url);

//3
window.location.href = url;

//4
window.top.location.replace(url);

//5
window.location.replace(url);
window.location.reload();

//6
window.top.location.href = url;
window.open(url);

//7
if (!!(window.history && history.replaceState)) {
    window.history.replaceState(
        {},
        "a title",
        url
    );
}

//8
document.location = url;
document.location.reload()

None of them seems to work. Are there any other suggestions on how to solve this? Much appreciated!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!