Click to See Complete Forum and Search --> : How to identify a mobile browser
pdqsw
10-07-2008, 04:30 AM
I would like to be able to redirect a user, coming to a single site, either to a mobile phone layout page or a standard PC layout page. In order to do this I need to identify if the browser is 'mobile' or 'not mobile'. I want to be able to do this solely at the server end.
Can anyone help me please? :)
stephan.gerlach
10-07-2008, 06:22 AM
You can use css to do that.
normal pc's will use media="screen"
mobiles, pda ect will use media="handheld"
However opera for windows mobile also uses media="screen" and handles it properly.
Hope this helps.
pdqsw
10-07-2008, 08:08 AM
Thanks Stephan.
This sounds like what I am after.
But please excuse my ignorance. How do I use this information within my webpage to perform the redirect?
stephan.gerlach
10-07-2008, 08:56 AM
You don't do a redirect.
You simply create the design for the screen. You need to separate html code and css code. Store css in a separate file. Create another css file that holds the css code for handheld devices.
Then in the html file in the head part you do this
<link rel="stylesheet" type="text/css" media="screen" href="link to the ccs file for pc" />
<link rel="stylesheet" type="text/css" media="handheld" href="link to the ccs file for handheld devices" />
If you make your html code efficient you can simply change the look of it via the css file.
pdqsw
10-07-2008, 09:02 AM
Ah yes.
That makes perfect sense.
Let me give it a try.
Thanks very much.
Paul
:)