[Javascript] Flash Detection

Terry bader at tcbader.com
Thu Mar 27 17:26:49 CST 2003


if you are working with a server-side language with session handling you can
use this process:

on entrance page:
open a new window, flashcheck. whatever size, could even be hidden if you
want.

on flashcheck (2 items):
plays a swf that only has a redirect to a page, flashset
Meta refresh, i usually set it for 6 secs, that redirects to flashno

on flashset:
set hasflash session var to 1
self.close

on flashno:
self.close

if you dont have session handling, use cookies.  the key is in flashcheck.
you can do similar to check for JS.


~ Terry
757 581-5981
AIM/Yahoo: lv2bounce


----- Original Message -----
From: "David T. Lovering" <dlovering at gazos.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Thursday, March 27, 2003 6:06 PM
Subject: Re: [Javascript] Flash Detection


> I'm no rocket scientist, but I would think that document.all would always
prove
> true, even with a blank HTML page.
>
> Also, while you can do a string operation implicitly on a string object,
it loses
> its "objectness" thereafter, so that it sometimes fails to take add on
functions
> as you'd suppose.
>
> Try
>
>       var myMimeTest = document.testMime.mimeType.toLowercase();
>       if (myMimeTest.indexOf('flash') != -1) { yada-yada...
>
>   Speaking of which, I don't see mimeType declared anywhere.
>
>   Also, while it is conceivable that in a formless environment
>
>       document.testMime (where testMime is an image object)
>
>   should work, I suspect most browsers will 'fake' a form[0] wrapper just
>   to conform to the DOM model.  Rather than deal with this, you are almost
>   better off wrapping your code in a form of your own invention, even if
>   you have to set the action="javascript:void(null)" to keep it from
>   going anywhere.
>
>   If there is an imposition of a form (fake or otherwise), the path to the
>   img object testMime will be
>
> document.forms[0].testMime....
>
>   I'll look this over later and in more detail and see if anything springs
>   out at me.
>
>   -- Dave Lovering
>
> Marcelo Simon wrote:
> >
> > 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
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>




More information about the Javascript mailing list