Skip to content

Instantly share code, notes, and snippets.

View ParvinEyvazov's full-sized avatar
✔️
Verified Official Github Account

Parvin Eyvazov ParvinEyvazov

✔️
Verified Official Github Account
View GitHub Profile
@ParvinEyvazov
ParvinEyvazov / index.tsx
Last active February 7, 2025 07:32
Open Mobile Browser from inApp browser automatically [Android & IOS]
/*
This code is used to detect if the user is in an in-app browser (e.g., Instagram, LinkedIn, TikTok) and redirect to a mobile browser if they are.
It uses the InAppSpy library to detect in-app browsers and the Bowser library to parse user agent strings.
It then determines the phone type based on the OS and constructs the redirection URL based on the phone type.
It also checks if the URL contains the 'redirected' parameter to prevent infinite redirect loop and removes the 'redirected' parameter from the URL.
It then redirects to the mobile browser if the user is in an in-app browser.
basicly:
for android, go to:
intent:${baseUrl}#Intent;scheme=https;package=com.android.chrome;end