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


