iPhone 5 - iOS - User Agents

iPhone 5 and iPod Touch 5th generation have a 4" screen, wdvga 640x1136px, 326 dpi (Retina Display); same width as iPhone 4 and iPhone 4S, but 176 more pixels height in portrait mode.

Detection

Using JavaScript, we can test for 568 pixels (height):


isIphone4Inches = (window.screen.height==568);

Using media queries we can detect the iPhone 5 like so:


@media (device-height: 568px) and (-webkit-min-device-pixel-ratio: 2) {
  /** iphone5 and ipod touch 5th gen **/
}

iPhone 5 and iOS 6 for html5 Developers