ColdFusion Dashboard for Mobile Devices

ColdFusion , Flex - Author:John Gag at 7:06 PM Add comments

I have been making flex 3 dashboards for various manager and they seem to really like them.  The problem that I am posed with now is that my company is run on Blackberry's and the managers want to be able to view the dashboards on their mobile devices.  Here is some stuff that I found along the way and maybe it will help some other out that need to accomplish this task.

I wanted to recognize that the user was coming from a mobile phone to redirect them to the mobile phone section of the website.  This is pretty easy to accomplishin ColdFusion.

<cfif CGI.HTTP_ACCEPT CONTAINS "text/vnd.wap.wml">
    <cflocation url="/cp/dash_mobile.cfm">
</cfif>
<cfif findNoCase("iphone", cgi.http_user_agent)>
  <cflocation url="/cp/dash_mobile.cfm" addToken="false">
</cfif>

I searched for ways to to recognize a mobile browser and found these two if statement.  The first if statement searches for a wireless browser language and redirects if it finds.  The next if statement solves the problem for the users with an iphone.  The iphone uses safari and it is not recognized as a mobile broswer. 

After the user has been redirected using <cflocation> I made a small replica or the flex 3 dashboard using cfchart format="jpg".  You may want to remove the graph tips as they come out messed up on blackberry and also make sure that your images are small in size or else it takes too long to load. I want to also point out that your page can be set up different for the iphone users because the browser is better. (Blackberry Storm comes out tomorrow so we shall see).  All of this will hopefully change when flex 3 is viewable on mobile devices ;) Let me know if you have any experience doing what I am trying to do

 

 

 

 

5 responses to “ColdFusion Dashboard for Mobile Devices ”

  1. Gary Fenton Says:
    That's useful information, John, thanks. Relying totally on the user agent string was turning out to be a nightmare. Check out this page which list agent strings for loads of mobile browsers: http://www.zytrax.com/tech/web/mobile_ids.html
  2. Craig Kaminsky Says:
    I actually ran into this problem for a project this past summer. I created a CFC that contained a listing of user agents known to be associated with mobile browsers. In the OnRequestStart method of my Application component, I do a quick user agent check to see if the current visitor is on a known mobile device and take action accordingly. To get my list of user agents, I combed through a few sites and made my array. I found roughly 33 unique tags or words inside a user agent string for mobile devices. The CFC's code is a little long for posting here but, if interested, I'd be happy to share.
  3. Gary Fenton Says:
    You'll also need to check for "application/vnd.wap.xhtml+xml" in cgi.http_accept to increase thoroughness. Another indicator of certain mobile devices is HTTP_X_WAP_PROFILE in the http header. They don't make things easy! Wouldn't it be great if every browser had to declare which CSS @media profile it prefers via the http header. That would have made so much more sense. (So anything asking for @handheld would get the mobile-specific version of the site served up.)
  4. John Gag Says:
    @Gary - Thanks for mentioning that. That will be helpful. @Craig - I will let you know if I need that cfc. Thanks!
  5. jinesh.k Says:
    hello sir, i want to do a small application for detect the browser. can u share the cfc what you did for detecting the broswer. thanks jinesh.k

Leave a Reply





Powered by Mango Blog. Design and Icons by N.Design Studio