Select to view content in your preferred language

Redirect site to non-Flash version when Player isn't detected (mobile devices)

1213
6
Jump to solution
11-26-2012 08:29 AM
TracySchloss
Honored Contributor
I have several very nice looking maps that are built in FLEX/Flash.  I received a lot of pressure to make them more mobile friendly  and management came out strongly "No Flash Player".  I got my first one working properly using the Javascript mobile components.   

It's not my intent to replace my existing FLEX sites, which have a lot more functionality in them then will fit on a small screen.  I'm planning on just adding a link on our web pages to the mobile version.   It would be really nice to also have the existing HTML wrapper of my FLEX sites offer to redirect them to the mobile version if it detects they don't have Flash.    They end up wasting a lot of time going down that path before they find out it isn't going to work on their phone.

Most of my sites are old enough they are still FLEX 3.    I don't know if the generic HTML wrapper that Flex Builder or Flash Builder changed between those versions.  I've only used the OOTB wrapper that gets created when you make a new project and it looks pretty plain.  Now that I'm learning JavaScript, it's not nearly as intimidating to go into it to make modifications.  I'm just not sure what to change.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
AaronNash1
Frequent Contributor
You could add some javascript to look and see if they are using a mobile browser and then redirect.
  <script type="text/javascript">    if( navigator.userAgent.match(/iPhone|iPad|BlackBerry|Android/i) )     {     if (document.cookie.indexOf("iphone_redirect=false") == -1)      {     window.location = "http://www.google.com";            }    }    </script>


There is already code to detect the version of flashplayer and embed the install, some people may just need to install flash player. May not want to redirect everyone. Just add the code under another script tag

View solution in original post

0 Kudos
6 Replies
AaronNash1
Frequent Contributor
You could add some javascript to look and see if they are using a mobile browser and then redirect.
  <script type="text/javascript">    if( navigator.userAgent.match(/iPhone|iPad|BlackBerry|Android/i) )     {     if (document.cookie.indexOf("iphone_redirect=false") == -1)      {     window.location = "http://www.google.com";            }    }    </script>


There is already code to detect the version of flashplayer and embed the install, some people may just need to install flash player. May not want to redirect everyone. Just add the code under another script tag
0 Kudos
TracySchloss
Honored Contributor
That works well - thank you.
0 Kudos
TracySchloss
Honored Contributor
Now that I have this in production, it doesn't look like Windows phone is accounted for in the list.  I'm having a hard time figuring out for sure what that is.  Is it iemobile or something else?
0 Kudos
AaronNash1
Frequent Contributor
I am pretty sure your right with iemobile...but who has a windows phone:)
0 Kudos
TracySchloss
Honored Contributor
I thought nobody.  But when I sent out my link, asking them to check and let me know what device they were using, 2 out of the 9 people who responded had one.
0 Kudos
DasaPaddock
Esri Regular Contributor
Can you ask them to go to http://ipogre.com and send you the browser information that's shown there?
0 Kudos