Processing
 

Flash always on top in Android browser workaround?

02/04/2012 19:41#1

Joined at: 7 months ago

Post: 1

Thank: 0

Thanked: 0

I have a website with a simple Flash animation behind some text and semi-transparent images as a background. I have used swfobject to embed it and set wmode opaque to make it display correctly in most browsers.

For browsers without Flash, the user gets a static background image instead and would not know they were missing anything. However, Android users get the flash background on top of everything as per the known issue with how Flash content is rendered in the Android browser making the site unusable.

I have added a crude browser sniff javascript function to the swfobject code to prevent it from loading for any user agent whith 'Mobile' in it:

<script type="text/javascript"> if (navigator.userAgent.indexOf('Mobile') == -1)     {         var flashvars = {};         var params = { wmode: "opaque" };         var attributes = {};         swfobject.embedSWF("Images/Layout/center_flash.swf", "flashBg",         "1004", "502", "9", "false", flashvars, params, attributes);     } </script> 

The only problem I have left is for Android users browsing with 'Mobile View' turned off as the user agent pretends to be a desktop version of Safari (I think). I do not wish to disable the Flash animation for all Safari users. Is there a way of blocking it for just Andriod users - even if they have 'Mobile View' disabled?

Possible ideas include:

  • detecting the Flash version with JavaScript or Flash. Does Android use specific versions (version numbers) of Flash which are different from the desktop equivalent?
  • blocking the specific user agents used by Android devices with 'Mobile View' disabled.

Has anyone come up with an effective workaround for this issue?

Your help/input is appreciated!

02/04/2012 19:56Top#2

bbedward

Member

Joined at: 11 months ago

Post: 3

Thank: 0

Thanked: 0

You can detect android only by checking the userAgent of the browser in your JavaScript

Something like this:

 if (navigator.userAgent.toLowerCase().indexOf("android") != -1)  {      // It's android  } 

As far as the flash issue itself, I don't know as I never use flash :P

edit

You can also use that technique for other useragents (I.E. iPhone, iPad, safari)

edit2

Sorry, I just went on my android phone and realized the actual setting changes the userAgent to whatever the user picks (desktop/ipad/iphone/safari). That's no good then, I apologize.

Unfortunately, what you are asking is very difficult then. There are no unique identifiers in the android flash version to give you any help. And the fact that android spoofs the userAgent makes it impossibly to detect if they are on mobile or not.

11/04/2016 18:06Top#3

Joined at: 11 months ago

Post: 11

Thank: 0

Thanked: 0

There exist services that can tell you whether a user is on mobile based on their IP.

I'm sorry to say I don't know how fast, reliable, or expensive they are, but if you must determine whether a user is on Android, that's an avenue to consider

Similar articles

Open a folder in finder/explorer from a webpage?

5 years ago - Reply: 2 - Views: 80

How do I escape a reserved word in Actionscript?

5 years ago - Reply: 2 - Views: 199

Save PPS/PPT files as SWF using C#

5 years ago - Reply: 2 - Views: 171

Ways of making a graphic/visual novel in flash

6 years ago - Reply: 3 - Views: 114

Use PhoneGap + HTML5 and an Embedded Flash Movie

5 years ago - Reply: 2 - Views: 96

View word docs and PDF in browser?

5 years ago - Reply: 2 - Views: 52

ActionScript 3 Read JPEG quality

7 years ago - Reply: 2 - Views: 59

Export/Test Movie Issues

5 years ago - Reply: 3 - Views: 39

Flash always on top in Android browser workaround?

5 years ago - Reply: 2 - Views: 149

Sending Json Form from Flash AS3

5 years ago - Reply: 2 - Views: 29

parsing a swf/fla (using php?)

6 years ago - Reply: 2 - Views: 44

Getting high FPS on Flash/AIR games for mobile?

4 years ago - Reply: 2 - Views: 59

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re