Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Supporting Technologies > HTML and JavaScript

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-11-2009, 08:54 AM   #1
dc2000
Registered User
 
Join Date: Oct 2008
Posts: 98
Default How to tell if Flash will not play on a client computer?

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.
dc2000 is offline   Reply With Quote
Old 04-17-2009, 03:27 PM   #2
tadster
tadster
 
tadster's Avatar
 
Join Date: Feb 2009
Location: Texas
Posts: 2,111
Default

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
tadster is offline   Reply With Quote
Old 04-17-2009, 04:57 PM   #3
dc2000
Registered User
 
Join Date: Oct 2008
Posts: 98
Default

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/flashp...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.
dc2000 is offline   Reply With Quote
Old 04-18-2009, 02:42 PM   #4
tadster
tadster
 
tadster's Avatar
 
Join Date: Feb 2009
Location: Texas
Posts: 2,111
Default

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.
tadster is offline   Reply With Quote
Old 04-18-2009, 04:17 PM   #5
dc2000
Registered User
 
Join Date: Oct 2008
Posts: 98
Default

Quote:
Originally Posted by tadster View Post
<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?
dc2000 is offline   Reply With Quote
Old 04-19-2009, 04:42 PM   #6
tadster
tadster
 
tadster's Avatar
 
Join Date: Feb 2009
Location: Texas
Posts: 2,111
Default

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 is offline   Reply With Quote
Old 05-06-2009, 08:43 PM   #7
tadster
tadster
 
tadster's Avatar
 
Join Date: Feb 2009
Location: Texas
Posts: 2,111
Default

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:
Code:
<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.
tadster is offline   Reply With Quote
Old 05-07-2009, 07:46 AM   #8
dc2000
Registered User
 
Join Date: Oct 2008
Posts: 98
Default

Thanks, tadster.
Quote:
Originally Posted by tadster View Post
and another option is to let users select whether they want the flash on or not.
What do you mean by that?
dc2000 is offline   Reply With Quote
Old 05-07-2009, 05:22 PM   #9
tadster
tadster
 
tadster's Avatar
 
Join Date: Feb 2009
Location: Texas
Posts: 2,111
Default

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).
tadster is offline   Reply With Quote
Old 05-07-2009, 06:24 PM   #10
dc2000
Registered User
 
Join Date: Oct 2008
Posts: 98
Default

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.
dc2000 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need my button to stay clicked! cpdbolinho ActionScript 2.0 7 10-08-2008 12:59 PM
Old version of flash player and location of flash player in the computer?? lysandre Flash 8 General Questions 4 01-03-2007 07:09 PM
flash client connecting to WebService Ronen ActionScript 2.0 0 08-09-2006 12:22 PM
How to load flash EMBED tags and movies with external script cybered HTML and JavaScript 1 09-23-2005 10:52 AM
Flash MX Developers Exam VitiminJ General Chat 34 05-05-2004 01:27 PM


All times are GMT. The time now is 07:15 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.