HTML question re Kirupa Flash detect tute

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


}
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


}
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

Dont use Alt tags for that, tags should be a short word to replace the image. Incase the image dosent show up, or someone is browsing using without images, or even the screen readers or whatnot.

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

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

 }
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>

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” ‘);
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">’);
document.write(’ </EMBED>’);
document.write(’ </OBJECT>’);
} else{
document.write(’’);
}
//–>
</SCRIPT><NOSCRIPT></NOSCRIPT>

<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

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” ‘);
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>

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

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