Currently in my Angular project, I am attempting to dynamically redirect users based on their device type. For example, if the user is on a Web platform, they will be redirected to www.web.com
. If they are on an Android device, they should go to www.android.com
, and for iOS devices, it should be www.iOS.com
. However, I am unsure of how to detect the user's device and implement this redirect logic.
TypeScript (TS)
if(mobile.android){ //Check for Android device
window.location.href='www.android.com'
}
else if(mobile.ios){ //Check for iOS device
window.location.href='www.ios.com'
}
else if(web){
window.location.href='www.web.com'
}