all articles

how to detect iphone6 & iphone6plus

2015-07-03 @sunderls

detect iPhone6 iPhone6Plus js

description, bug

how can we detect iPhone6 & iphone6Plus

solution

we can just check whether the screen.width matches.

since iOS offers the same screeen.width no matter you rotate or not, you can just check the width.

code

var isIPhone6 = navigatoer.userAgent.toLowercase().indexOf('iphone') != -1 && screen.width === 375;

var isIPhone6Plus: navigatoer.userAgent.toLowercase()..indexOf('iphone') != -1 && screen.width === 414;