[Javascript] Flash Detection

Jaime Iniesta jaime at alazan.com
Fri Mar 28 10:00:23 CST 2003


Detecting if Flash is installed with JavaScript can be difficult as every
browser behaves in a different way. To me, the best way to do this is using
Flash to detect Flash... You can have a little Flash movie that redirects to
the Flash main site. On that same starting page, you place an HTML
redirection to the Non-Flash pages on a few seconds. If the visitos has
Flash installed, the little movie (2 Kb or so) will redirect him/her to the
Flash page. If not, the HTML redirection will redirect him/her to the
non-flash page.

Jaime

-----Mensaje original-----
De: javascript-bounces at LaTech.edu [mailto:javascript-bounces at LaTech.edu] En
nombre de Marcelo Simon
Enviado el: jueves, 27 de marzo de 2003 23:40
Para: [JavaScript List]
Asunto: [Javascript] Flash Detection

Hi all,

I'm having a headache over this script to detect if is flash is present or
not. If someone could see what my eyes are not seeing please help me . :)

<img name="testMime" src="test.swf">

<script language="JavaScript"><!--
var can_play = false;

var mimetype = 'application/x-shockwave-flash';

if (navigator.mimeTypes) {
   if (navigator.mimeTypes[mimetype] != null) {
      if (navigator.mimeTypes[mimetype].enabledPlugin != null) {
         can_play = true;
      }
   }
}

if (!can_play && navigator.appVersion.indexOf('MSIE') !=-1) {
   if (document.all &&
document.testMime.mimeType.toLowercase().indexOf('flash') !=-1) {
      can_play = true;
   }
}

if (can_play)
   window.location = 'plug.html';
else
   window.location = 'noplug.html';

//-->
</script>

TIA
Marcelo Simon


_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript



More information about the Javascript mailing list