Next.js Discord

Discord Forum

Title: Redirecting from in-app browser to default browser in Next.js payment page

Unanswered
Forest yellowjacket posted this in #help-forum
Open in Discord
Forest yellowjacketOP
Hello everyone,
I'm facing a challenge with my Next.js-based payment page and could use some help. Here's the situation:

I have a QR code that links to my payment page built with Next.js.
When users scan this QR code using various payment apps, it opens in the in-app browser of those apps.
I want to redirect users from the in-app browser to their device's default browser (Safari for iOS, Chrome for Android).

What I've done so far:

I've successfully implemented detection for whether the page is opened in an in-app browser.
I can also detect the type of device (iOS or Android).

The problem:
I can't seem to force the page to open in the default browser. I've tried methods like:

window.open("", "_blank")
window.location.href = url

But these aren't working as expected in the in-app browser context.

What I need:
A reliable method to redirect from the in-app browser to the default browser on both iOS and Android devices.
Has anyone encountered a similar issue or knows of a solution that works across different in-app browsers? Any insights or code examples would be greatly appreciated.
Thank you in advance for your help!

0 Replies