By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,526 Members | 1,888 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,526 IT Pros & Developers. It's quick & easy.

Flash detection Javascript doesn't work in Firefox

P: n/a
Hi, I use a handy little Javascript Flash detection script on a number
of sites (copied below). Usually works great, but I just started
trying Firefox and it's not working. A few browsers are referenced in
the script so I presume that Firefox needs to be added somewhere --
does anyone know how I could update this to be supported by Firefox?
Thanks!

<SCRIPT TYPE="text/JavaScript">
<!--
var MM_contentVersion = 5;
var plugin = (navigator.mimeTypes &&
navigator.mimeTypes["application/x-shockwave-flash"]) ?
navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin :
0;
if ( plugin ) {
var words = navigator.plugins["Shockwave
Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words[i])))
continue;
var MM_PluginVersion = words[i];
}
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
&& (navigator.appVersion.indexOf("Win") != -1)) {
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS
hide this from IE4.5 Mac by splitting the tag
document.write('on error resume next \n');
document.write('MM_FlashCanPlay = (
IsObject(CreateObject("ShockwaveFlash.ShockwaveFla sh." &
MM_contentVersion)))\n');
document.write('</SCR' + 'IPT\> \n');
}
if ( MM_FlashCanPlay ) {
document.write('<OBJECT
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
document.write('
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
');
document.write(' ID="flash5" WIDTH=308 HEIGHT=68 ALIGN="">');
document.write(' <PARAM NAME=movie VALUE="/flash/logo.swf">
<PARAM NAME=loop VALUE=false> <PARAM NAME=quality VALUE=high> <PARAM
NAME=bgcolor VALUE=#4A3476> ');
document.write(' <EMBED src="/flash/logo.swf" loop=false
quality=high bgcolor=#4A3476 ');
document.write(' swLiveConnect=FALSE WIDTH=306 HEIGHT=68
NAME="flash5" ALIGN=""');
document.write(' TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
document.write(' </EMBED>');
document.write(' </OBJECT>');
} else{
document.write('<IMG SRC="/images/logo.gif" HEIGHT=68
WIDTH=306 BORDER=0>');
}
//-->
</SCRIPT><NOSCRIPT><IMG SRC="/images/logo.gif" HEIGHT=68 WIDTH=306
BORDER=0></NOSCRIPT>
Jul 23 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a


Cliff R. wrote:
Hi, I use a handy little Javascript Flash detection script on a number
of sites (copied below). Usually works great, but I just started
trying Firefox and it's not working.
var MM_contentVersion = 5;
var plugin = (navigator.mimeTypes &&
navigator.mimeTypes["application/x-shockwave-flash"]) ?
navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin :
0;
if ( plugin ) {
var words = navigator.plugins["Shockwave
Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words[i])))
continue;
var MM_PluginVersion = words[i];
}
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}


That part of the script is the part to check Netscape or other browsers
like Firefox having the navigator.mimeTypes collection so that script
works with Firefox, for instance when I run that part here with Firefox
1.0 and Shockwave Flash player 7.something installed the variable
MM_FlashCanPlay is true.
So what exactly happens for you when you say "doesn't work with
Firefox", any script errors?
What does
about:plugins
show, does that show Shockwave Flash for the MIME type
application/x-shockwave-flash?

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

P: n/a
Hi -- when I said it doesn't work in Firefox, I mean that nothing is
showing where the Flash should be. Not the Flash itself or the image
that's supposed to show if there is no Flash player. And I don't see
any script errors, it's just not showing anything. I'm not sure what
all the elements of the script mean because I didn't write it, but I
do know that it's always worked.

But here's the weird thing, I just noticed that it works on some sites
and not on others (meaning the Flash movie does display). For
example, the same script works on http://www.skyblues.com/ but not on
http://www.bluerill.com/ . Any thoughts or help? Thank you!

On Sun, 12 Dec 2004 12:25:40 +0100, Martin Honnen <ma*******@yahoo.de>
wrote:


Cliff R. wrote:
Hi, I use a handy little Javascript Flash detection script on a number
of sites (copied below). Usually works great, but I just started
trying Firefox and it's not working.


var MM_contentVersion = 5;
var plugin = (navigator.mimeTypes &&
navigator.mimeTypes["application/x-shockwave-flash"]) ?
navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin :
0;
if ( plugin ) {
var words = navigator.plugins["Shockwave
Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words[i])))
continue;
var MM_PluginVersion = words[i];
}
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}


That part of the script is the part to check Netscape or other browsers
like Firefox having the navigator.mimeTypes collection so that script
works with Firefox, for instance when I run that part here with Firefox
1.0 and Shockwave Flash player 7.something installed the variable
MM_FlashCanPlay is true.
So what exactly happens for you when you say "doesn't work with
Firefox", any script errors?
What does
about:plugins
show, does that show Shockwave Flash for the MIME type
application/x-shockwave-flash?


Jul 23 '05 #3

P: n/a


Cliff R. wrote:
when I said it doesn't work in Firefox, I mean that nothing is
showing where the Flash should be. Not the Flash itself or the image
that's supposed to show if there is no Flash player. And I don't see
any script errors, it's just not showing anything. But here's the weird thing, I just noticed that it works on some sites
and not on others (meaning the Flash movie does display). For
example, the same script works on http://www.skyblues.com/ but not on
http://www.bluerill.com/ .


I see Flash movies on http://www.bluerill.com/ with Firefox 1.0, I
haven't checked how many the page source includes and whether all are
there but there is Flash visible on the page.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #4

P: n/a
Weird, I have Firefox 1.0 also and I'm just seeing 2 empty blue spaces
where the Flash animations should be (there are 2 animations on that
page). I checked to make sure Javascript is enabled and it is. Any
other thoughts on why this might be?

Thank you for your help!
On Sun, 12 Dec 2004 20:31:32 +0100, Martin Honnen <ma*******@yahoo.de>
wrote:


Cliff R. wrote:
when I said it doesn't work in Firefox, I mean that nothing is
showing where the Flash should be. Not the Flash itself or the image
that's supposed to show if there is no Flash player. And I don't see
any script errors, it's just not showing anything.

But here's the weird thing, I just noticed that it works on some sites
and not on others (meaning the Flash movie does display). For
example, the same script works on http://www.skyblues.com/ but not on
http://www.bluerill.com/ .


I see Flash movies on http://www.bluerill.com/ with Firefox 1.0, I
haven't checked how many the page source includes and whether all are
there but there is Flash visible on the page.


Jul 23 '05 #5

P: n/a


Cliff R. wrote:
I have Firefox 1.0 also and I'm just seeing 2 empty blue spaces
where the Flash animations should be (there are 2 animations on that
page). I checked to make sure Javascript is enabled and it is. Any
other thoughts on why this might be?


Not really, other than checking
about:plugins
to see whether Firefox correctly finds the Flash player and the right
version of it.
Then to find out what the problem could be I would start by using static
HTML markup to embed the Flash (e.g. <embed ...>) and see whether that
is rendered by Firefox. Only if it is I would look at the script again
as then it is likely that the script use is the cause of the problem.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #6

P: n/a
i am facing the same problem, did u find the solution?

Jul 23 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.