# HTML question re Kirupa Flash detect tute

**URL:** <https://forum.kirupa.com/t/html-question-re-kirupa-flash-detect-tute/115207>\
**Category:** Uncategorized\
**Created:** [July 6, 2004, 3:58pm UTC](https://forum.kirupa.com/t/html-question-re-kirupa-flash-detect-tute/115207 "2004-07-06T15:58:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteveD](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@SteveD](https://forum.kirupa.com/u/SteveD)\
**Post date:** [July 6, 2004, 3:58pm UTC](https://forum.kirupa.com/t/html-question-re-kirupa-flash-detect-tute/115207/1 "2004-07-06T15:58:38Z")

</div>

Hi,  
Have had a good look at the Kirupa tute for detecting the flash player, the second part that loads an image instead of a flash movie if the player doesn’t exist is exactly what I need.  
However I want to make the image ‘clickable’ but I am uncertain as to where to place the **a href** tags and **alt** text ( for rollover), to refresh memories the else arguement in the tute looks like this

```auto

}
else
{
document.write('<IMG SRC="siteImgs/logo.gif" ALIGN="right" usemap="#script" BORDER=0>');
}
//-->
</SCRIPT><NOSCRIPT<IMG SRC="siteImgs/logo.gif" WIDTH="208" HEIGHT="56" usemap="#script" BORDER=0></NOSCRIPT>

```

I have tried altering the code like this

```auto

}
else
{
document.write('<a href="www.macromedia.com"><IMG SRC="siteImgs/logo.gif" alt = "click here" ALIGN="right" usemap="#script" BORDER=0></a>');
}
#and like this
//-->
</SCRIPT><NOSCRIPT><a href="www.macromedia.com"><IMG SRC="siteImgs/logo.gif" alt = "click here" WIDTH="208" HEIGHT="56" usemap="#script" BORDER=0></a></NOSCRIPT>

```

has anyone else dealt with this, and if so how ?

Cheers

SteveD

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 4:27am UTC](https://forum.kirupa.com/t/html-question-re-kirupa-flash-detect-tute/115207/2 "2004-07-07T04:27:42Z")

</div>

Hi,

Yes I know, and my **alt** only say “click here” - pretty short. What I cannot figure out is how to make the image clickable within the code from that tute - any ideas ???

SteveD

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 8:00pm UTC](https://forum.kirupa.com/t/html-question-re-kirupa-flash-detect-tute/115207/3 "2004-07-07T20:00:28Z")

</div>

**Alt** tags should be discriptive…  
but that aside, it worked for me.

```auto
 }
else
{
document.write('<IMG SRC="siteImgs/logo.gif" ALIGN="right" usemap="#script" BORDER=0>');
}
//-->
</SCRIPT><NOSCRIPT>
<a href="www.mac.com"><IMG SRC="siteImgs/logo.gif" WIDTH="208" HEIGHT="56" usemap="#script" BORDER=0></a>
</NOSCRIPT>

```

---

<div class="post-metadata">

**Author:** ![aryastark](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@aryastark](https://forum.kirupa.com/u/aryastark)\
**Post date:** [August 18, 2004, 7:09am UTC](https://forum.kirupa.com/t/html-question-re-kirupa-flash-detect-tute/115207/4 "2004-08-18T07:09:38Z")

</div>

Hi i’ve tried using the same Kirupa script (as below but I’ve replaced all the file names accordingly) to detect and replace the SWF file with a GIF file but when i check the page on a system that doesn’t have Flash, the replacement GIF file is stuck right at the top of the page and the place where the swf file should be is now empty with a ‘missing image’ icon.

i am really bad with JS so i think i must have done something really wrong?

Appreciate your help! Desperately need a solution!

\<SCRIPT language=JavaScript1.1\>  
\<!–  
var MM\_contentVersion = 6;  
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\*)))  
continue;  
var MM\_PluginVersion = words\*;  
}  
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&gt;  
’); //FS hide this from IE4.5 Mac by splitting the tag  
document.write(‘on error resume next  
’);  
document.write(‘MM\_FlashCanPlay = ( IsObject(CreateObject(“ShockwaveFlash.ShockwaveFlash.” & MM\_contentVersion)))  
’);  
document.write(’\</SCR’ + ‘IPT&gt;  
’);  
}  
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](http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0)” ‘);  
document.write(’ ID=“script” WIDTH=“300” HEIGHT=“200” ALIGN=”"\>’);

document.write(’

‘); \</p\> document.write(’ \<EMBED src=“script.swf” quality=high bgcolor=#FFFFFF ‘);  
document.write(’ swLiveConnect=FALSE WIDTH=“300” HEIGHT=“200” NAME=“script” ALIGN=""’);  
document.write(’ TYPE=“application/x-shockwave-flash” PLUGINSPAGE="[http://www.macromedia.com/go/getflashplayer"\>’](http://www.macromedia.com/go/getflashplayer%22%3E'));  
document.write(’ \</EMBED\>’);  
document.write(’ \</OBJECT\>’);  
} else{  
document.write(’ ![]()’);  
}  
//–\>  
\</SCRIPT\>\<NOSCRIPT\> ![]()\</NOSCRIPT\>

```auto
<SCRIPT LANGUAGE=JavaScript1.1>
<!--
var MM_contentVersion = 6;
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*)))
  continue;
  var MM_PluginVersion = words*; 
	 }
 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\> 
'); //FS hide this from IE4.5 Mac by splitting the tag
 document.write('on error resume next 
');
 document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))
');
 document.write('</SCR' + 'IPT\> 
');
}
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="script" WIDTH="300" HEIGHT="200" ALIGN="">');
 document.write(' <PARAM NAME=movie VALUE="script.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> '); 
 document.write(' <EMBED src="script.swf" quality=high bgcolor=#FFFFFF ');
 document.write(' swLiveConnect=FALSE WIDTH="300" HEIGHT="200" NAME="script" 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="script.gif" WIDTH="300" HEIGHT="200" usemap="#script" BORDER=0>');
}
//-->
</SCRIPT><NOSCRIPT><IMG SRC="script.gif" WIDTH="300" HEIGHT="200" usemap="#script" BORDER=0></NOSCRIPT> 

```

arya

---

<div class="post-metadata">

**Author:** ![aryastark](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@aryastark](https://forum.kirupa.com/u/aryastark)\
**Post date:** [August 18, 2004, 7:11am UTC](https://forum.kirupa.com/t/html-question-re-kirupa-flash-detect-tute/115207/5 "2004-08-18T07:11:10Z")

</div>

sorry here’s the script:

\<SCRIPT LANGUAGE=JavaScript1.1\>  
\<!–  
var MM\_contentVersion = 6;  
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\*)))  
continue;  
var MM\_PluginVersion = words\*;  
}  
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&gt;  
’); //FS hide this from IE4.5 Mac by splitting the tag  
document.write(‘on error resume next  
’);  
document.write(‘MM\_FlashCanPlay = ( IsObject(CreateObject(“ShockwaveFlash.ShockwaveFlash.” & MM\_contentVersion)))  
’);  
document.write(’\</SCR’ + ‘IPT&gt;  
’);  
}  
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](http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0)” ‘);  
document.write(’ ID=“script” WIDTH=“300” HEIGHT=“200” ALIGN=”"\>’);  
document.write(’ \<PARAM NAME=movie VALUE=“script.swf”\> \<PARAM NAME=quality VALUE=high\> \<PARAM NAME=bgcolor VALUE=#FFFFFF\> ‘);  
document.write(’ \<EMBED src=“script.swf” quality=high bgcolor=#FFFFFF ‘);  
document.write(’ swLiveConnect=FALSE WIDTH=“300” HEIGHT=“200” NAME=“script” ALIGN=""’);  
document.write(’ TYPE=“application/x-shockwave-flash” PLUGINSPAGE=“[http://www.macromedia.com/go/getflashplayer](http://www.macromedia.com/go/getflashplayer)”\>’);  
document.write(’ \</EMBED\>’);  
document.write(’ \</OBJECT\>’);  
} else{  
document.write(’\<IMG SRC=“script.gif” WIDTH=“300” HEIGHT=“200” usemap="#script" BORDER=0\>’);  
}  
//–\>  
\</SCRIPT\>\<NOSCRIPT\>\<IMG SRC=“script.gif” WIDTH=“300” HEIGHT=“200” usemap="#script" BORDER=0\>\</NOSCRIPT\>

---

<div class="post-metadata">

**Author:** ![SteveD](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@SteveD](https://forum.kirupa.com/u/SteveD)\
**Post date:** [August 19, 2004, 5:43am UTC](https://forum.kirupa.com/t/html-question-re-kirupa-flash-detect-tute/115207/6 "2004-08-19T05:43:43Z")

</div>

Hi,  
I can’t see anything wrong with your code, it is identical to mine, however I would think about changing the name of your .swf and .gif, if you sift through the code you will find  
\*\* ID="script"  
script.swf  
script.gif\*\*

This may ( or may not be) the problem but is worth trying.  
I should say that I have never tested this code in a browser that doesn’t have FlashPlayer installed, normally, I set the code to look for something that cannot be there as in

```auto
var MM_contentVersion = 8;

```

when it cannot find version 8 ( as it doesn’t exist) my gif is loaded in the right place.  
Anyway try the above and let me know

Cheers

SteveD
