How does one differentiate between Chrome and Safari in an iOS7 useragent string?
问题 Useragent details are sketchy, or I'm not looking in the right places. What, in terms of a navigator.userAgent.match() , would differentiate between Chrome and Safari on iOS7, iPad or iPhone? 回答1: var ua = navigator.userAgent; var matches = ua.match(/^.*(iPhone|iPad).*(OS\s[0-9]).*(CriOS|Version)\/[.0-9]*\sMobile.*$/i); if (!matches) console.log("Not what we're looking for."); else { console.log(matches[1]); if (matches[2] === 'OS 7') console.log(matches[2]); else console.log('Not the right