js 判断各个平台

ua = navigator.userAgent.toLowerCase(),
isIOS = ua.indexOf('ipad') > -1 || ua.indexOf('iphone') > -1,
isMac = ua.indexOf('macintosh') > -1,
isWin = window.Windows !== undefined,
isAndroid = !isWin && ua.indexOf('android') > -1,
isWinPC = isWin && Windows.System.Profile.AnalyticsInfo.versionInfo.deviceFamily.includes('Desktop'),
isDesktop = isMac || isWinPC;

你可能感兴趣的:(js 判断各个平台)