PDA

View Full Version : How to tell if Flash will not play on a client computer?


dc2000
04-11-2009, 08:54 AM
Hi everyone:


I know quite a few examples when Flash applet may not play on a client computer:

1. 64-bit browser on PC;
2. If a user opts not to run plug-ins in the Preferences of the browser.

Is there any way to tell if that is the case, say, from HTML or JavaScript? If there's a way I'd like to respond in a certain way and maybe provide an HTML based substitute instead of a standard Adobe download link.

tadster
04-17-2009, 03:27 PM
SWFObject.js is a javascript library(script) you can use to detect the presence and ability of flash on a users system, it also provides options to display alternate content. It is the most popular tool to do so right now, Adobe also offers scripts to do the same thing.
Another way is to place a small test flash in your page that then loads the "real" flash.
The way I do this is to use the external interface of flash to call a js function, from the tester swf, that swaps out one flash for another (the tester for the real). If this swap does not happen then javascript knows(assumes) that a flash player is not present, so it then gives a jpg or redirects the user. You can set the JS to respond in any manner you want.

It takes far less code than SWFObject to just use the tester swf method, however it relies on the innerHTML command.
You can see the swf test method in use on my website www.actiontad.com feel free to look at the atadftest.js file.
If the swap does not happen, after 30 seconds, a jpg is given instead, you can see that in action by disableing your flash player when you visit.

hope this helps

dc2000
04-17-2009, 04:57 PM
Hey, tadster, thanks for your post. While searching myself I came up with the following link from Adobe that gives their recommended Flash detection technique:
http://www.adobe.com/products/flashplayer/download/detection_kit/

To be honest with you I had no idea that it will be so complicated.

As for your method - the 30 seconds one - it sounds good, except that, first, on one hand it seems kind of too long since I don't think an average user now will remain on a site for that time if the content doesn't load, but on the other hand, people with dial-up or very slow computers may require that much time, or even longer to load something up (I know sounds incredible but I witnessed one case where in the end I got the standard, "Website doesn't work" comment, which turned out to be a very old computer and a slow dial-up connection.)

I'm thinking that this method requires actually two steps:

1. Use the <noscript> HTML tag in case scripting is disabled in the browser.

2. Otherwise use the JS sample from the tutorial in the link above to detect the Flash version and see if it matches the one required for your SWF to run.

That might be quite a challenge to deploy for the first time, but hopefully Adobe keeps the same detection mechanism in the future so that we wouldn't have to re-invent the wheel again.

Cheers.

tadster
04-18-2009, 02:42 PM
Yes, the 30 seconds is for dial up and slow users, it can be any time you want however.
We are talking about a swf that would be less than 2kb, on actiontad it's only 900 bytes.
Most poeple have flash and would not even encounter that anyway.

<noscript> tags are not strict, so if your going for a strict mark-up that won't work.
just use a div that says like, "if you have javascript this message will go away..."
and have JS onload make the display of that div none.

"my" method tests for the external interface availability, neither SWFObject or the Adobe scripts do that, also its the oldest method for detecting the flash player. My site uses the external interface heavily so i must test for its availability.
However, your steps will work just as good, in general.

dc2000
04-18-2009, 04:17 PM
<noscript> tags are not strict, so if your going for a strict mark-up that won't work.Can you please explain why it won't work?

tadster
04-19-2009, 04:42 PM
it will "work" it's just that in strict mark-up noscript tags are.. strange..and don't validate,
but all you would have to do to get your page to validate is use the transitional DTD instead of strict.
Are you going for XHTML 1.0 strict? If not don't worry about it, it will work just fine.

I also gave you an example of what to do instead of <noscript> tags if you are going for a strict markup,
also feel free to look at the source code of my site.

tadster
05-06-2009, 08:43 PM
i was a bit wrong... <noscript> tags will work in a strict markup. You need to be sure to include a div inside them like this:

<noscript><div>JavaScript disabled</div></noscript>



hope you got everything sorted out DC2000

oh and another option is to let users select whether they want the flash on or not.

dc2000
05-07-2009, 07:46 AM
Thanks, tadster.
and another option is to let users select whether they want the flash on or not.What do you mean by that?

tadster
05-07-2009, 05:22 PM
Let the user activate the flash...reverse my way a bit...still have a test swf swap itself for the real swf via the external interface and javascript, but let the whole thing be activated by a user click. (instead of onload or automatically)
So the 30 seconds still happens, but at least they would know the flash is loading and that they started it.
(although the 30 seconds happens only if the test swf did not swap itself - they have no flash)
(and note that this technique still calls for a preloader in the real swf or some sort of pre-loading imagery in the wrapper)

This way is useful if flash is secondary or not needed in your site.
And gives the user more control.
Due to the fact that i will be adding more and more examples to my site, i've redesigned it around a database of examples.
I've employed this user activated technique now also, to activate the flash version of the banner, users must click on the (t).

dc2000
05-07-2009, 06:24 PM
OK, thanks, that's an idea.

The way I'm using Flash is to make my whole front page with it. I got so disillusioned about JavaScript and how browser-dependent and -specific it is that I decided to do it entirely with flash, but here comes another problem (actually a couple, like I pointed out in the beginning):

1. I don't know the percentage, but there are still people out there that don't have Flash installed -- I don't know -- due to older hardware, or maybe because of a paranoia of scripts running in their browser. So obviously I have to think about them;

2. To my chagrin, I just learned recently that Flash cannot run on any of the 64-bit Windows, and the number of those systems is increasing with each day.

So for those two I will have to provide a separate HTML-only page.

tadster
05-07-2009, 07:00 PM
i honestly didn't know about the 64-bit thing..but it's likely that the 64 bit platforms will do something about it or Adobe will. flash, or the like, is being used more and more everyday (cell phones are the webs future), and your right, it's less browser specific than javascript, but..some people are still scared of it.
So yes you have to have a back-up, for me i just put the back-up up front, that's an easy way to ensure that those without flash will not leave the site for fear of the flash or some "you dont have flash" alert.

For now some sort of flashless alternative is only professional, to do without one is not wise.
But i sense the future heading in a more flash-full direction.

dc2000
05-08-2009, 02:01 AM
i honestly didn't know about the 64-bit thing..I didn't know myself until recently while being at my friend's house his daughter couldn't open her myspace or something on his new laptop and asked me to do it for her. The way it looked like was that there was a message instead of Flash plug-in directing to the adobe site that in a very confusing way stated that one needs a 32-bit browser running on 64-bit system or something like that. In other words all your flash plug-ins will be totally useless on that system. (For the reference, his laptop is just maybe a month old.)

I did some Google search and here's off the Adobe site:
http://labs.adobe.com/technologies/flashplayer10/faq.html#flashplayer10FAQ_64-bit04
When will 64-bit versions of Flash Player for Windows and Mac be available?
We expect to provide native support for 64-bit platforms in an upcoming major release of Flash Player. Windows, Macintosh and Linux players will ship at the same time.