iPhone Detection Methods

**READ WebKit Detect script updated for iPhone and iPod touch

User Agent

Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3

JavaScript

if(navigator.userAgent.match(/iPhone/i)){
do.Something();
}

CSS

<link type="text/css" rel="stylesheet" media="only screen and (max-device-width: 480px)" href="iPhone.css">

You can also use in CSS browser specific declarations to modify some style properties for just webkit.

/* This CSS increases the size of the paragraph elements */
p {
    -webkit-text-size-adjust: 120%;
}

Or you can do a whole bunch of declarations inside a media type block

@media handheld, only screen and (max-device-width: 480px) {
    /* overrides or style additions for iPhone */
}
page_revision: 7, last_edited: 1235191827|%e %b %Y, %H:%M %Z (%O ago)
Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.