views:

60

answers:

5

I need to make my site work well on a blackberry, i haven't put too much effort into getting this working yet, but i have a few questions which google is struggling with.

I've read about detecting brower type and modifying the default behaviour of asp.net controls here

How would I go about supplying a differant stylesheet to a specific browser, should i just do this?

if (Request.Browser.Browser.ToString() == "blackberry") //pseudocode
{
    Response.Write("bb.css");
}
else
{
    Response.Write("bb.css");
}

This will work fine, but i feel like there is a better method, i'm sure i've read about something in the past but i can't seem to recall.

I'm also considering a response.redirect to a differant page for a blackberry, which at the moment i would implemenet in a similar way.

Any thought or suggestions.

+2  A: 

Check this out

http://mdbf.codeplex.com/

Also nerddinner.com at http://nerddinner.codeplex.com/

Vivek Bernard
I do have to give the actual project a slight thumbs up, although it doesn't seem to be properly extensible: Mobile phones have almost 300 recorded varying features and properties so far and the amount is growing. For example that API in its current state won't be able to differentiate between the three different geolocation API:s currently available. Gah, I'm sounding way too negative here - I don't mean to.
Esko
+1  A: 

Generally it is possible for a browser to pretend it's a different one (this was used e.g. by Opera which was by default set up to pretend it's an IE to overcome some restrictions on problematic sites). Personally I think the blackberry and similar devices are quite easy to detect so there's no reason to not do it like in your sample.. the site from Vivek looks good as well ;)

Thomas Wanner
+1  A: 

While not directly related to your actual question, you may want to read what I wrote as an answer here under the title "Identifying the phone".

What you should really be looking for is a way to detect a feature of the current device and boy are you in for a lot of work if you want to do it properly. The problem as I stated in that other answer is that thanks to the history of user agent strings they haven't been reliable for a long time.

If mobile phones as a whole won't be your primary platform, you shouldn't dwell into this that much, find something that works such as checking if user agent string contains "Blackberry" and be satisfied with that. If, however, you really do want to do it properly, you have to develop a feature detection framework to do the job with all its possible combinations and permutations for you - there's no easy path when going down that road.

I'm sorry that I feel the need to be such a demotivator.

Esko
I guess i'm fortunate that, since it's an enterprise intranet site i only need to support the blackberry and nothing else, thanks!
Paul Creasey
A: 

Regarding Mobile Device Browser File:

Due to the organizational restructuring of the team that developed and supported the Mobile Device Browser file, we will no longer have the resources to support and update this CodePlex project.

The team will be providing two more releases – one on the 27th July 2010 and the final release on the 24th August 2010.

Lucifer
A: 

Please use http://51degrees.codeplex.com/. It is an ASP.NET open source module which detects mobile devices and provides auto redirection to mobile optimized pages when request is coming from mobile device. It makes use of WURFL mobile device database. For redirection there is no need to modify existing ASP.NET web application pages.

Apart from this it also gives upto-date mobile capability information like manufacturer, model, screen height & width, image formats supported and MANY MORE...... which helps to customize pages for best mobile output.

Amit Patel