Created
August 27, 2024 20:05
-
-
Save ramazansancar/84892b39afa3a4af724d61dfde13968d to your computer and use it in GitHub Desktop.
Mobile device detection redirector
This file contains hidden or 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
<!-- view-source:https://www.moneypay.com.tr/download.html --> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<script> | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); | |
ga('create', 'UA-XXXXX-Y', 'auto'); | |
ga('send', 'pageview'); | |
</script> | |
<script> | |
function getMobileOperatingSystem() { | |
var userAgent = navigator.userAgent || navigator.vendor || window.opera; | |
// Windows Phone must come first because its UA also contains "Android" | |
if (/windows phone/i.test(userAgent)) { | |
return "Windows Phone"; | |
} | |
if (/android/i.test(userAgent)) { | |
return "Android"; | |
} | |
// iOS detection from: http://stackoverflow.com/a/9039885/177710 | |
if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) { | |
return "iOS"; | |
} | |
return "unknown"; | |
}</script> | |
<script> | |
function DetectAndServe(){ | |
let os = getMobileOperatingSystem(); | |
if (os == "Android") { | |
window.location.href = "https://play.google.com/store/apps/details?id=[package_name]&gl=TR"; | |
} else if (os == "iOS") { | |
window.location.href = "https://apps.apple.com/us/app/moneypay/id[id]"; | |
} else { | |
window.location.href = "https://apps.apple.com/us/app/moneypay/id[id]"; | |
} | |
} | |
</script> | |
</head> | |
<body onload="DetectAndServe()"> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment