cssblackberrymobilescreenhandheld

How to target the Blackberry browser?


I am using the following to target iphones, and handheld devices to use specific mobile styles sheets but the Blackberry browers is picking up only the regular screen style sheets.

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

All the other mobile devices I've tested the site on are picking up the correct style sheets.

Does anyone know a way to target the Blackberry browser to do the same?

Thanks!


Solution

  • I ended up using Javascript to detect user agents.

    Then printing mobile.css for handheld and screen if it is a mobile device (because the BlackBerry and iPhone think they are screens) and printing the regular style sheets if it isn't a mobile device.

    It doesn't work for any device that doesn't have Javascript but they are probably better off seeing the bare bones version of the site anyway.