Subsribe to our RSS

latest reactions

christian louboutin shoes
With that kind of traffic you want to ad …
Rahul Anand
Thanks for the nice post. It works for m …
Serkan
thx a lot! …
msb
Thanks for above solution.There is ano …
Lori S.
FYI, I was using this successfully in CF …

Use OpenDNS

mxna feeds

cfmailparam behaviour change in CF9.01ColdFusion Job Opportunity in Houston, TXFacial Recognition in 14 Lines Of ColdFusionColdFusion UPS PackageColdFusion Job Opportunity in Arlington, VAColdFusion Job Opportunity in San Diego, CASome ColdFusionBloggers.org GuidelinesColdFusion Positions In CaliforniaListChangeDelimsunix epoch with coldfusionQuery scripting bug in Coldfusion 9Scoth On The Rock 2011 Tickets on salefoursquareCFC updated to version 1.0, now includes ColdFusion return typeFramework One Birds of a Feather session at CFUnitedWhat makes you a good ColdFusion programmer?

All files are strictly confidential: all information is classified.
© Copyright 2002 - 2010 mximize.com.
All right reserved.

MXNA webfeed

Visit Carlos Gallupa

Simple, but effective mobile redirect function

<cffunction name="isMobile" returntype="boolean">
    <cfset var ret = false />
   
    <cfif cgi.http_accept contains "text/vnd.wap.wml" || cgi.http_accept contains "application/vnd.wap.xhtml+xml" || structKeyExists(cgi,"HTTP_X_WAP_PROFILE")>
        <cfset ret = true />
    <cfelseif findNoCase("iphone", cgi.http_user_agent)>
        <cfset ret = true />
    </cfif>
   
    <cfreturn ret />
</cffunction>

<cfoutput>
    Is it a mobile? #yesNoFormat(isMobile())#
</cfoutput>

4006 viewed | 2 opinion(s)  | del.icio.us | Digg it | Tjarko @ 01/02/09 22:21 cet


Reactions:

Idel wrote.... (site)

I suggest to use the Apache Mobile Filter, this apache module give all information about the device as environment variables. And also its render the images to the screen size of mobile devices.
Is an open source project, it is free and you can use with every language you want.

For more info:http://www.idelfuschini.it/apache-mobile-filter-v2x.html

14 May 2009 22:55 cet  

Lori S. wrote....

FYI, I was using this successfully in CF 8, but under ColdFusion 9 you'll need to change:

structKeyExists(cgi,"HTTP_X_WAP_PROFILE")

To:

CGI.HTTP_X_WAP_PROFILE IS NOT ""

This is because under CF 9 ColdFusion always returns true when it tests for the existence of a CGI variable.See the CGI environment variables page in the online CF 9 documentation for info.

09 June 2010 19:56 cet  

Leave your comment

Your name


Your url/website/link/email....


Some room for your reaction is placed here..



The answer to the ultimate question is?? (42 ;-))




URL en mail addresses are translated for you... life sometimes is that simple!!