0

I need a javascript to detect if viewing a page from an Iphone 5 with ios 8 and chrome. I found this but it only detect if it is an iPhone but not the version or the browser.

if(/(iPhone)/i.test(navigator.userAgent)) { 
if(/OS [8]_\d(_\d)? like Mac OS X/i.test(navigator.userAgent)) {  
    alert("SI");
} 
  • 2
    Why do you need to detect this specific device. It is *far* better to test for specific features. – Jeremy J Starcher Oct 06 '16 at 04:41
  • Possible duplicate of [How to determine which iPhone version the javascript code runs on?](http://stackoverflow.com/questions/8309998/how-to-determine-which-iphone-version-the-javascript-code-runs-on) – Anik Islam Abhi Oct 06 '16 at 04:43
  • 1
    Possible duplicate of [Detect if device is iOS](http://stackoverflow.com/questions/9038625/detect-if-device-is-ios) – Pranesh Ravi Oct 06 '16 at 05:07
  • Please spellcheck your question title. –  Oct 06 '16 at 06:05

0 Answers0