Created
September 2, 2016 16:53
-
-
Save hawkapparel/22f2f72f522540814fc4e66e8de29d57 to your computer and use it in GitHub Desktop.
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
// by default it takes ua string from current browser's window.navigator.userAgent | |
var parser = new UAParser(), | |
result = parser.getResult(); | |
if(result.device.type == undefined) { | |
console.log('PC'); | |
window.location.href = "http://www.movistar.com.pe/hogar/tv/gol-peru-cmd/-/tab/app-futbol-movistar"; | |
} | |
else if(result.device.type == 'mobile' || result.device.type == 'tablet') { | |
console.log('Mobile/Tablet'); | |
if(result.os.name == 'iOS') { | |
console.log('iOS'); | |
window.location.href = "https://itunes.apple.com/pe/app"; | |
} | |
else if(result.os.name == 'Android') { | |
console.log('Android'); | |
window.location.href = "https://play.google.com/store/apps/details"; | |
} | |
else { | |
console.log('Fallback OS'); | |
window.location.href = "https://www.google.com.pe/"; | |
} | |
} | |
else { | |
console.log('Fallback Device'); | |
window.location.href = "https://www.google.com.pe/"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment