/**
* Windows Phone 8.1 fakes user agent string to look like Android and iPhone.
*
* @type boolean
*/
var deviceIsWindowsPhone = navigator.userAgent
.indexOf("Windows Phone") >= 0;
/**
* iOS 4 requires an exception for select elements.
*
* @type boolean
*/
var deviceIsIOS4 = deviceIsIOS
&& (/OS 4_\d(_\d)?/).test(navigator.userAgent);
IOS6~7
/**
* iOS 6.0-7.* requires the target element to be manually derived
*
* @type boolean
*/
var deviceIsIOSWithBadTarget = deviceIsIOS
&& (/OS [6-7]_\d/).test(navigator.userAgent);