chorg has asked for the wisdom of the Perl Monks concerning the following question:

I have to detect the version of the flash plugin for users of our site. I don't trust javascript for this (who can trust the stuff?). I'd like to use perl for this. Is there a handy module to do this existing already? If not, how would I read the plugins detected by the browser?
_______________________________________________
"Intelligence is a tool used achieve goals, however goals are not always chosen wisely..."

Replies are listed 'Best First'.
Re: Cross browser plugin detection
by c-era (Curate) on Jan 16, 2001 at 20:14 UTC
    You are going to have to use some javascript. That javascript can send to your server the list of pluggins the client has and you can parse that info in perl, and then send the flash or an error page. Or you can just use javascript to determine which gets loaded.
Re: Cross browser plugin detection
by little (Curate) on Jan 16, 2001 at 20:26 UTC
    A plug-in will enable the browser to handle documents with specific mime types, so if the list of mime-types the browser sends to the server encloses also "application/pdf" it means that the user uses a plugin to display pdf-files and you can send this kind o file to the clients browser. But be aware that e.g. the Internet explorer sends only a "*/*" mime-type list if the reload button was hit.

    Have a nice day
    All decision is left to your taste
      Another problem with this approch is that you won't get any of the information you want, you just know that they have a program that will do something with that file, you don't know what the program is or what version it is. This is one of those times when using javascript will be easier and more reliable (you won't find many more).
      How would I get the list of mime types that the browser sends?
      _______________________________________________
      "Intelligence is a tool used achieve goals, however goals are not always chosen wisely..."
Re: Cross browser plugin detection
by ichimunki (Priest) on Jan 16, 2001 at 20:34 UTC

    Ick Flash. </twit-mode>

    You don't trust JavaScript, yet you trust Flash? {grin}

    I have not tried the following, for all I know it does not work, but in theory it should, so please let me know if you try it how it turns out... One of the HTTP headers should be "Accept: application/x-shockwave-flash". You can check for this by using the CGI.pm method Accept(), which returns a list of all Accepts in the header. The method has some additional features that may be useful as well.

Re: Cross browser plugin detection
by repson (Chaplain) on Jan 17, 2001 at 07:08 UTC
    One method for alternative display is making use of the html <OBJECT> tag, which allows the specification of alternative content. Read up on it in this part of the html specs, or follow this example from there.
    <P><!-- First, try the Python applet --> <OBJECT title="The Earth as seen from space" classid="http://www.observer.mars/TheEarth.py"> <!-- Else, try the MPEG video --> <OBJECT data="TheEarth.mpeg" type="application/mpeg"> <!-- Else, try the GIF image --> <OBJECT data="TheEarth.gif" type="image/gif"> <!-- Else render the text --> The <STRONG>Earth</STRONG> as seen from space. </OBJECT> </OBJECT> </OBJECT>
    I'm not sure if it will work with multiple versions of flash, but it may be worth a try.