Forum Moderators: open

Message Too Old, No Replies

Browser detection and redirect for small screens

         

Jeffry

7:59 pm on Jan 23, 2005 (gmt 0)

10+ Year Member



Hi,

I'm looking for a way to detect the visitors browser type, especially from PDA's, handhelds and smartphones using Imode and WAP to automatically redirect them to the right page.

Thanks,
Jeffry

tedster

9:54 pm on Jan 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is, unfortunately, not a straighforward issue for at least two reasons:

1. Many handheld user agents will spoof their identity and then take the fullscreen page and do what they want to with it im order to adapt it to their proprietary rendring standards.

2. If you try to use javascript to measure the available screen size, you will discover that many handheld browsers come with javascript disabled by default.

Ideally, the solution would be a full implementation of the CSS2 media="handheld" - but here we currently have a bit of an impasse.

Because so few page authors are creating their pages with alternate css for handhelds, the handheld browsers do not yet support it (Opera a notable exception). And of course, because there is minimal support from the user agents, developers do not yet invest the resources to create the handheld css file.

firstreflex

10:30 pm on Jan 23, 2005 (gmt 0)

10+ Year Member



2. If you try to use javascript to measure the available screen size, you will discover that many handheld browsers come with javascript disabled by default.

Have a base stylesheet for handhelds and small resolutions and use javascript to detect larger resolutions and send those users the full stylesheet.

Jeffry

8:48 am on Jan 24, 2005 (gmt 0)

10+ Year Member



I know I can use css to make a page suitable for handhelds, but I don't want to change my current pages. So, i'm looking for a solution to redirect my current pages to a handheld optimised page.

I found following code to insert in my .htaccess file but it seems not to be working. And it's only to redirect a page to a handheld optimised page, and what about WAP phones? I have to redirect them to a .wml page - is it possible to alter the code for that purpose too?

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^(DoCoMoŠJ-PHONEŠKDDIŠUP.BrowserŠDDIPOCKET) [NC]
RewriteCond %{REQUEST_URI}!^/mobile
RewriteRule .* /mobile/index.html [L]

I also found a coldfusion code but I don't know how to use it or where to put the code. Any advice?

<CFIF #CGI.HTTP_ACCEPT# CONTAINS "text/vnd.wap.wml"> <CFLOCATION URL="http://wap.somedomain.com"> </CFIF>

Thanks,
Jeffry