Flash detection script isn't working.

I've got the following code posted on http://216.167.122.202/index_flash.asp.  The purpose of it is to display a flash banner if the client has flash, and a randomized graphic if the client does not have flash.  For some reason it's not working.  For easy reference, the rest of the code is here: http://216.167.122.202/flash_detect.js


<script type="text/javascript" src="flash_detect.js">
function getFlashVersion() { return null; };

var requiredVersion = 5
var r = ((Math.ceil(Math.random() * 6))-1)
var flashVersion = getFlashVersion()
           
if (flashVersion >= requiredVersion) {
      document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="750" height="235"><param name="movie" value="images/banner_home.swf"><param name="quality" value="high"><embed src="images/banner_home.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="750" height="235"></embed></object>')
}
else if (flashVersion == 0 || flashVersion == flashVersion_DONTKNOW || flashVersion == null) {
      document.write('<img src="images/bannerhome/' + r + '.jpg" height="235" width="750">')
}
LVL 1
SeveristhAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

devicCommented:
<script>
/*devic's method*/
function getFlashVer()
{
      for(var i=10; i>0; i--)
      {
            try
            {
                  var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
                  return i;
            }
            catch(e){}
      }
      return 0;
}
alert(getFlashVer());
</script>
0
SeveristhAuthor Commented:
What browsers does your script work with, Devic?
0
devicCommented:
Severisth,
I have flash installed only on IE, but I believe it will work almost on all browsers.
0
badrulnmCommented:
Severisth,
>> function getFlashVersion() { return null; };

You should remove the above line from your html file because it override the working function in the flash_detect.js file that you load with <script type="text/javascript" src="flash_detect.js">.


devic,
>> var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);

that only works on IE.

0
devicCommented:
SP1 :)
for netscape:
=============
      if (navigator.plugins)
      {
            for(var i=0;i<navigator.plugins.length;i++)
            {
                  if(navigator.plugins[i].name.match(/Flash/i))
                  {
                        return navigator.plugins[i].description.match(/Flash ([\d])/)[1];
                  }
            }
      }
=================================
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.