I am working on the web application project using angularjs which it has the mobile applications too they are android and Ios. Now i want when the web application is open in mobile i need to find the device type and check the mobile app is installed or not, if installed should open in mobile app, if not a download button is there for app-link.Thanks in advance
Asked
Active
Viewed 2,436 times
-1
-
this is all extremely well documented online, please do some research before asking questions – Simon McLoughlin Sep 07 '16 at 14:19
-
Possible duplicate of [JavaScript how to check User Agent for Mobile/Tablet](http://stackoverflow.com/questions/21757105/javascript-how-to-check-user-agent-for-mobile-tablet) – Simon McLoughlin Sep 07 '16 at 14:20
2 Answers
1
function checkOperatingSystem()
{ var userAgent = navigator.userAgent || navigator.vendor || window.opera;
//Check mobile device is Android
if (/android/i.test(userAgent)) {
//Add your Code here
}
//Check mobile device is IOS
if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
//Add your Code here
}
//Check device os is Windows (For Laptop and PC)
if (navigator.appVersion.indexOf("Win")!=-1)
{
//Add your Code here
}
//Check device os is MAC (For Laptop and PC)
if (navigator.appVersion.indexOf("Mac")!=-1)
{
//Add your Code here
}
}

Rohan Varma
- 101
- 7
0
Using $window
services,
you can check like this one
var userAgent = $window.navigator.userAgent;
/(iPhone|iPad|iPod).* OS 9_\d/.test(userAgent) && !/Version\/9\./.test(userAgent);

RIYAJ KHAN
- 15,032
- 5
- 31
- 53