Forum Moderators: open

Message Too Old, No Replies

Redirect for Mobile Web Browsers

         

sbridge

5:34 pm on Apr 24, 2008 (gmt 0)

10+ Year Member



Hello. I have a client that has a .MOBI website and they want to redirect any mobile users to that website from her main domain. I was able to find JavaScript code that redirects any Windows Mobile devices and iPhone devices. I thought I was done and then she told me she has a Blackberry and it doesn't work. I really don't know what to do with this. I searched all over the internet and I can't find anything that detects Blackberry browsers...

I was hoping to keep it in Javascript since it works across ASP and PHP, but at this point I'm desperate and willing to accept ASP. I've found some PHP solutions, but the server I'm working on is only ASP...

Help!

Ocean10000

2:38 pm on Apr 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



A quick and dirty way is to filter on a few keywords that are included in Mobile User-Agents. Which will redirect most mobiles out there to your mobile site without much work.

  • "Windows CE"
  • "PalmSource"
  • "PalmOS"
  • "MIDP-"
  • "portalmmm"
  • "Symbian OS"
  • "UP.Browser"
  • "MobilePhone"
  • "Nokia"
  • "DoCoMo"
  • "BlackBerry"

Another common and easy check is to check if "x-wap-profile" header is present, which is supplied by many mobile browsers.

[edited by: Ocean10000 at 2:40 pm (utc) on April 26, 2008]