During mobile development, you often need to provide different jump pages for different device types. For how to determine the device type, see the following code. Haha, you can use the package directly.
var uaFanction = function( var UA = window.navigator.userAgent, IsAndroid = (/Android|HTC/i.test(UA) || !! (window.navigator[‘platform‘] + ‘‘).match(/Linux/i)), IsIPad = !IsAndroid && /iPad/i.test(UA), IsIPhone = !IsAndroid && /iPod|iPhone/i.test(UA), IsIOS = IsIPad || IsIPhone; if(IsIOS){ window.location.href=‘IOS‘; } if(IsAndroid){ window.location.href=‘Android‘; })
Or directly write in the script block.
var UA = window.navigator.userAgent, IsAndroid = (/Android|HTC/i.test(UA) || !! (window.navigator[‘platform‘] + ‘‘).match(/Linux/i)), IsIPad = !IsAndroid && /iPad/i.test(UA), IsIPhone = !IsAndroid && /iPod|iPhone/i.test(UA), IsIOS = IsIPad || IsIPhone; if(IsIOS){ window.location.href=‘IOS‘; } if(IsAndroid){ window.location.href=‘Android‘; }