views:

151

answers:

1

We want to use the same page to service the desktop, iPhone, and BlackBerry, so we have to come up with a way for the different devices to load different stylesheets.

So, is there a way to specify a stylesheet to run on BlackBerry?

For example, iPhone's use the media attribute:

<link media="only screen and (max-device-width: 320px)" href="style.css" ...
+1  A: 

I would parse the User Agent string using a server side language and serve the correct stylesheet. The blackberry seems to identify itself with "Blackberry/xyz". See e.g. here

Pekka
Yeah, I was really hoping not to have to do it server side, but it's looking like that might be the only way.
Luke
Make sure you also look at the "profile" and/or "x-wap-profile" headers, because mobile browsers such as BlackBerry sometimes spoof the "user-agent" header to fool sites into thinking you're using Firefox or IE
Marc Novakowski