Detect if Flash available

(1) I know this is pretty easy but I last looked at this a few years ago and want a quick and easy way to detect if Flash is available - and a modern 2010 method.

Ideally it will have:
(a) simple script that can be called on any page that needs it:
function flashYes(version) {
//checks if supplied version of flash is avail, if blank checks for any version being available
//return true or false
…every page that needs flash can then do this
if(flashYes(7)==1) {
//display Flash if v7 or above
} else {
//display alternate content
(this must pick up full Flash not the rubbish Flash Lite on mobiles)
… I’m not interested in telling the user to upgrade to flash, just display the alternate content I decide.
(although if this can be done without js then even better)
(b) Must work on all desktop browsers (old and new).
(c) If JavaScript is used then if js is off to show the non-flash one by default.

(2) Also, what is the best way to embed Flash? Dreamweaver goes on about my scripts using an old Flash embed method. Again, I am looking for modern 2010 methods that work on all old and new browsers (including any mobile phones that may be able to display FULL Flash). Although if in doubt about a mobile I’ll just show the alternate content.


Code for embedding Flash in a page:

<object data="flash.swf"
width="300" height="200" type="application/x-shockwave-flash">
<param name="src" value="flash.swf">
<param name="quality" value="high">
<param name="bgcolor" value="#FFFFFF">
<param name="wmode" value="transparent">
<param name="pluginurl" value="">
content for browsers that don't support flash go here

You’d then use Swfobject to test for the particular flash version required to override the object tag when necessary.

The only time the <embed> tag has ever been needed is to support Netscape 4.

Note the actual filename needs to be specified twice as some browsers use the data attribute of the object tag while others use the src or movie param tag.

Thanks for the reply.

I’ve only just got chance to look at this!!

I want a flash script that…

  • doesn’t need JavaScript to work if possible (unless there is a good reason for it)
  • If they don;t have Flash or have an old version, I DON’T want it to update, I just want it to show alternate content.

(1) Do I need Swfobject for this?
(2) How would I do what I want.

They must have Flash v9 or they see alternate content.

Edit: just noticed as well that an old script of mine uses <object> but when opening Dreamweaver it says something like “recent IE versions don’t support <object> tag” - what’s this all about?

Thanks for the help.