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:
<cfif findNoCase('blackberry', CGI.HTTP_USER_AGENT)>
<cflocation url="http://blackberry.yourdomain.com" addtoken="no">
<cfelseif findNoCase('iphone', CGI.HTTP_USER_AGENT)>
<cflocation url="http://iphone.yourdomain.com" addtoken="no">
<cfelseif CGI.HTTP_ACCEPT CONTAINS "text/vnd.wap.wml">
<cflocation url="http://wap.yourdomain.com" addtoken="no">
Hope you enjoy this code snippet.
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.