Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Flash Detection
- From: dlovering at gazos.com (David T. Lovering)
- Subject: [Javascript] Flash Detection
- Date: Thu Mar 27 17:05:43 2003
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@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
- Follow-Ups:
- [Javascript] Flash Detection
- From: Terry
- [Javascript] Flash Detection
- References:
- [Javascript] select
- From: Michael Dougherty
- [Javascript] select
- From: Kelly Zhu
- [Javascript] Flash Detection
- From: Marcelo Simon
- [Javascript] select
- Prev by Date: [Javascript] select
- Next by Date: [Javascript] Flash Detection
- Previous by thread: [Javascript] Flash Detection
- Next by thread: [Javascript] Flash Detection
- Index(es):