Last active
May 24, 2022 17:56
-
-
Save ethaizone/a8c8e20c680d510d758d6d2b3980f230 to your computer and use it in GitHub Desktop.
[PHP] Auto redirect to app store. (Android/IOS)
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
<?php | |
// android store | |
if (preg_match('#android#i', $_SERVER ['HTTP_USER_AGENT'])) { | |
header('Location: market://details?id=com.google.android.apps.maps'); | |
exit; | |
} | |
// ios | |
if (preg_match('#(iPad|iPhone|iPod)#i', $_SERVER ['HTTP_USER_AGENT'])) { | |
header('Location: itms://itunes.apple.com/us/app/google-maps-real-time-navigation/id585027354?mt=8'); | |
exit; | |
} | |
// for another os | |
echo $_SERVER ['HTTP_USER_AGENT']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems good but it does not work on some devices. Safari on some iOS devices cant understand itms type. So it is necessary to paste good old Location: https://itunes.apple.com...
Probably some android does the same (i have not seen that yet) but I used the same way for android Location: https://play.google.com/store/apps