Many of our clients have been asking about detecting if a user is using a blackberry or iPhone etc to view their website and redirect to a mobile version of their websites. Well we have put together a little bit of code to do this:

Code example:

<cfif findNoCase('blackberry', CGI.HTTP_USER_AGENT)>
<cflocation url="" addtoken="no">
<cfelseif findNoCase('iphone', CGI.HTTP_USER_AGENT)>
<cflocation url="" addtoken="no">
<cfelseif CGI.HTTP_ACCEPT CONTAINS "text/vnd.wap.wml">
<cflocation url="" addtoken="no">

Hope you enjoy this code snippet.

Leave a Reply

Your email address will not be published. Required fields are marked *

About Host Media

We have been hosting websites since 2002 and are always moving forward. All articles written under the Host Media author are created by the team who support our customers.


ColdFusion/Railo & MySQL


, , , , , , , ,