Monday, January 20, 2025

Flash Test Page

Use these to jump around or read it all…


[The Code]
[Altering the Code]


Howdy. If you’re here, then you most likely have the Flash plugin installed on your system. If not, then most likely, you arrived by clicking on the link I put on the page for those who do not have Flash.

Either way, let me take a look at your system. Ah. I’ve got it.

There’s a little bit of Swami scripting there for you. I did it to simply prove that it is possible to look at a person’s computer and check for numerous types of plugins. In this specific case, we’re dealing with a Flash plugin.
And it’s about time. I’m getting tired of all of the pages that ask if I have Flash or not. Stop asking me. Test for me and then send me to a page that’s optimized for my system. You’re the Webmaster! Help me! Help me enjoy your page!!


OK, then. Blood pressure is lowering.

There. Better.

The script above isn’t overly useful for anything more than a parlor trick, but in case you’re interested, here’s a link to the page that offers it. Nope, I didn’t write it. I must give credit where credit is due. It is a nice piece of work.

Lately I have been seeing two methods of setting an immediate check for a Flash plugin. One is done through Flash itself. Since I am nowhere near a Flash expert, I’ll send you to the Macromedia site if you’d like to see that
method. Here’s a link to the page.

The problem with the two methods noted above, a firewall page and the Macromedia Flash format, is that both stop me at the front door of a site. I have to either make a choice or wait. My research, and just about every study I’ve read, suggests the users do not want to be stopped. They would rather the choice be made for them.

Just as you can set a JavaScript to test for browser type, version, screen sizes, and internal parameters, so can you use JavaScript to test for plugins.

Let’s do the Flash plugin shall we?



The Code

Although I enjoy writing most of the JavaScripts distributed on this site, I didn’t write this one. In fact, I don’t know who did. I found the script by doing a Google search on the words “Detect Flash Plugin.” It seems like a stock script because I found it on numerous sites covering several different topics. It was used on at least 20 different sites that I found. At no time did I ever find a copyright or author name. That leads me to believe it’s a distributed script. Plus, one must enforce copyright or lose it. I’ll be more than pleased to offer the author’s name here if he or she can prove authorship to me.


I’m going to offer it here mainly because it’s the best script I’ve seen to this point in that it is easy to understand, gets the job done efficiently, and works like other browser detect scripts.


You’ll take the code below, paste the entire thing into a document. Nothing else should be placed into the document you’re making. Please note the BODY tag there at the end. That’s real important. It’s what triggers the script and offers the two possible page destinations.

Here’s the code:



<HTML>
<HEAD>



<SCRIPT LANGUAGE=”JavaScript”>

<!–

function MM_checkPlugin(plgIn, theURL, altURL, autoGo)

{



//v3.0



var ok=false;

document.MM_returnValue = false;

with (navigator)

if (appName.indexOf(‘Microsoft’)==-1)

ok=(plugins && plugins[plgIn]);

else if (appVersion.indexOf(‘3.1’)==-1)



{



//not Netscape or Win3.1



if (plgIn.indexOf(“Flash”)!=-1 && window.MM_flash!=null)

ok=window.MM_flash;

else if (plgIn.indexOf(“Director”)!=-1 && window.MM_dir!=null)

ok=window.MM_dir;

else ok=autoGo;

}



if (!ok) theURL=altURL;

if (theURL) window.location=theURL;



}

//–>

</SCRIPT>


<META HTTP-EQUIV=”refresh” CONTENT=”8;
URL=NON-FLASHPAGE.html”>

</HEAD>




<!– Get what is below all onto one line –>

<!– Get what is below all onto one line –>



<BODY BGCOLOR=”#FFFFFF”
onLoad=”MM_checkPlugin(‘Shockwave Flash’,’FLASHPAGE.html’,’NON-FLASHPAGE.html’,true);return document.MM_returnValue”>


<!– Get what is above all onto one line –>

<!– Get what is above all onto one line –>

</BODY>
</HTML>



Altering The Code

Basically you’ll need to make one change to the META command just above the /HEAD tag and two changes in the BODY tag. See where I have the code, “‘FLASHPAGE.html’,’NON-FLASHPAGE.html’?”


Put in the address of the page that contains the Flash and then the address of the page that does not have the Flash where it suggests. Also, put the URL of the non-Flash page in the META tag. That’s it.


There are a couple of downfalls to the script in that Flash cannot be detected in Netscape 2, Explorer 3 and 4 on Mac and Konqueror. That’s why I stuck that META command in there. I placed it after the JavaScript code and set it to eight seconds. That way if the script fails to work because of the version bug then the page will change for the user. I would set that META link to the non-Flash page just to be sure.


That’s That

There you go. Enjoy it. It’s a nice little script to help out your Flash and non-Flash users.

 
Enjoy!



[The Code]
[Altering the Code]

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Popular Articles

Featured