JavaScript and Flash detection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mika S.

    JavaScript and Flash detection

    Hi,

    How can I detect if the Flash plugin is installed? Should be working
    with the most common browsers and environments.

    Thanks,
    Mika

  • Klaus Johannes Rusch

    #2
    Re: JavaScript and Flash detection

    "Mika S." wrote:
    [color=blue]
    > How can I detect if the Flash plugin is installed? Should be working
    > with the most common browsers and environments.[/color]

    A good piece of code is available at
    http://www.dithered.com/javascript/f...ect/index.html, works well
    for all current browsers if you modify the call like this:

    <script language="Javas cript" type="text/javascript">
    //<![CDATA[
    function getFlashVersion () { return null; };
    //]]>
    </script>
    <script language="Javas cript" type="text/javascript"
    src="flash_dete ct.js">
    </script>


    --
    Klaus Johannes Rusch
    KlausRusch@atme dia.net



    Comment

    • HikksNotAtHome

      #3
      Re: JavaScript and Flash detection

      In article <bdhpq9$kg1$1@p hys-news1.kolumbus. fi>, "Mika S."
      <mika.salonen@k oti.soon.fi> writes:
      [color=blue]
      >Hi,
      >
      >How can I detect if the Flash plugin is installed? Should be working
      >with the most common browsers and environments.
      >
      >Thanks,
      >Mika[/color]

      <script type="text/javascript">
      var flashEnabled = confirm('Click OK if you have Flash, click Cancel if you do
      not have the Flash plugin');
      if (flashEnabled)
      {alert('Wow, you have Flash!')}
      else
      {alert('OOOps, No Flash installed')}
      </script>

      Anything else you try will have flaws. Even the above has flaws. How do you use
      javascript to detect flash is javascript is disabled?
      --
      Randy
      All code posted is dependent upon the viewing browser
      supporting the methods called, and Javascript being enabled.

      Comment

      • Mika S.

        #4
        Re: JavaScript and Flash detection

        "HikksNotAtHome " <hikksnotathome @aol.com> wrote in message
        news:2003062717 0745.09580.0000 1065@mb-m13.aol.com...
        [color=blue]
        > Anything else you try will have flaws. Even the above
        > has flaws. How do you use javascript to detect flash
        > is javascript is disabled?
        > --
        > Randy[/color]

        Thanks for that, Randy. A very good point.

        Mika

        Comment

        • Klaus Johannes Rusch

          #5
          Re: JavaScript and Flash detection

          "Mika S." wrote:
          [color=blue]
          > "Klaus Johannes Rusch" <KlausRusch@atm edia.net> wrote in message
          > news:3EFC7446.F 74AF636@atmedia .net...[color=green]
          > >[color=darkred]
          > > > How can I detect if the Flash plugin is installed? Should be
          > > > working with the most common browsers and environments.[/color]
          > >
          > > A good piece of code is available at
          > > http://www.dithered.com/javascript/f...ect/index.html,[/color]
          >
          > Thanks a lot! That was perfect.
          >
          > By the way, do you know if the script is freeware and free for
          > commercial purposes, too?[/color]

          See http://www.dithered.com/javascript/index.html: "This is a collection
          of scripts that I've created and/or modified. Do whatever you want with
          them. All I ask is that any comments in the code remain as is"

          --
          Klaus Johannes Rusch
          KlausRusch@atme dia.net



          Comment

          • Klaus Johannes Rusch

            #6
            Re: JavaScript and Flash detection

            HikksNotAtHome wrote:
            [color=blue]
            > <script type="text/javascript">
            > var flashEnabled = confirm('Click OK if you have Flash, click Cancel if you do
            > not have the Flash plugin');
            > if (flashEnabled)
            > {alert('Wow, you have Flash!')}
            > else
            > {alert('OOOps, No Flash installed')}
            > </script>
            >
            > Anything else you try will have flaws. Even the above has flaws. How do you use
            > javascript to detect flash is javascript is disabled?[/color]

            I suspect that Flash plugin detection will work more reliably than asking users
            whether or not they have Flash installed ("Do I have what installed?") If
            Javascript is not available falling back to the plain, non-Flash version is usually
            a reasonable alternative.

            <script type="text/javascript">
            if (goodFlashVersi on) {
            document.write( '<!-- put flash stuff here -->');
            }
            else {
            document.write( '<!-- put plain version here -->');
            }
            </script>
            <noscript>
            <!-- put plain version here -->
            </noscript>

            --
            Klaus Johannes Rusch
            KlausRusch@atme dia.net



            Comment

            Working...