Search code examples
cssipadsafarimobile-safari

Apple's recommendation on browser sniffing


Does Apple have any recommendation for using any technique for browser sniffing (e.g. to distinguish between desktop IE/ FF / Mobile Safari (i.e. iPad)) / Other tablets

I know Apple wants us to avoid using User-agent for the same.

Is the media technique foolproof way to differentiate between iPad and say Xoom?

<link rel="stylesheet" media="all and (min-device-width: 481px) and (max-device-width: 1024px)" href="ipad.css">  

Solution

  • Rather than trying to detect device/user-agent, you want to focus on checking the capabilities of the browser. This includes screen resolution, JS support, CSS support, and more.

    Media queries is only one of many techniques you can employ to make your website work well across many devices. To get you started, here are a few helpful resources: