This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 |