Simple way to identify iOS user agent in a jQuery if/then statement?

technopeasant picture technopeasant · Sep 14, 2011 · Viewed 44.5k times · Source

Exactly like it sounds..

Is there some magical and easy way to say:

    if (user agent is iOS) {
        if (browserRatio >=1.5) {
            $container.css('min-height', '360px');
        } else {
            $container.css('min-height', '555px');
        }
     }

Answer

technopeasant picture technopeasant · Sep 14, 2011

Found it.

if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
    if (browserRatio >=1.5) {
        $container.css('min-height', '360px');
    } else {
        $container.css('min-height', '555px');
    }
}