Rajeev
Rajeev

Reputation: 46979

Detect flash plugin from Javascript

http://www.javascriptkit.com/script/script2/plugindetect.shtml

I am trying to detect flash plugin with Javascript from the above url, but the code doesn't seem to work for IE. Am I doing anything wrong here?

I just need to see whether the flash plugin is installed on the browser or not.

if (pluginlist.indexOf("Flash")== -1)
{
  alert("You do not have flash player plugin installed.Please install flash player");
  window.location = "/home";
}

Upvotes: 2

Views: 6819

Answers (3)

Nisha
Nisha

Reputation: 56

i too tried the same flash plugin but in different link. I tried the following javascript code:

<script type="text/javascript" src="swfobject.js"></script>

<div id="flashcontent">
  This text is replaced by the Flash movie.
</div>

<script type="text/javascript">
   var so =
       new SWFObject("movie.swf", "mymovie", "400", "200", "8", "#336699");
   so.write("flashcontent");
</script>

Prepare an HTML element that will hold our Flash movie. The content placed in the ‘holder’ element will be replaced by the Flash content, so users with the Flash plug-in installed will never see the content inside this element. This feature has the added bonus of letting search engines index your alternate content.

var so = new SWFObject(swf, id, width, height, version, background-color
         [, quality, xiRedirectUrl, redirectUrl, detectKey]);

And get succeeded. You can also try this code and tell me what happens. I hope you will get success. All The Best.

Upvotes: 1

Sean Patrick Floyd
Sean Patrick Floyd

Reputation: 299208

swfobject is the established quasi-standard for dealing with flash in JavaScript.

There's a tutorial for Detecting Flash Player versions and embedding SWF files with SWFObject 2

Upvotes: 1

eHussain
eHussain

Reputation: 3377

I tried to use the same plugin of the link you posted.

I used following code and it worked fine in my IE too..

<html>
    <head>

        <script language="javascript" type="text/javascript" src="plugins.js" ></script>

        <script language="javascript" type="text/javascript">
            if (pluginlist.indexOf("Flash")== -1)
            {
              alert("You do not have flash player plugin installed.Please install flash player");
              window.location = "/home";
            }
            else{
                alert("You have it installed");
            }
        </script>
    </head>

    <body>


    </body>
</html>

I think the problem seems with the way of writing tag. Have you made it exactly like mine? Or you can go with my HTML.

Thanks!

Hussain

Upvotes: 0

Related Questions