# Flash detection in Javascript

**URL:** https://forum.kirupa.com/t/flash-detection-in-javascript/183649
**Category:** web dev
**Created:** [March 29, 2006, 1:05am UTC](https://forum.kirupa.com/t/flash-detection-in-javascript/183649 "2006-03-29T01:05:53Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![leisuresuitlissy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/leisuresuitlissy/32/2109_2.png) [@leisuresuitlissy](https://forum.kirupa.com/u/leisuresuitlissy)
#### Post date: [March 29, 2006, 1:05am UTC](https://forum.kirupa.com/t/flash-detection-in-javascript/183649/1 "2006-03-29T01:05:53Z")

</div>

Hi people.  
Hi. I have done the javascript /flash detection tutorial that displays an image if the user has no player. It works, except the image that displays appears at the top of the screen, and I need it to appear in the bottom right. Suspect its because the javascript is in a head tag. Any ideas?

I was told by someone I work with that that I have to “put it in a function and then call the function where I want the image to appear”. But I’m not sure on which line put the 'function { ’ or how to call it. and am too embarassed to ask.

Any help would be very much appreciated.

EDIT: This is the code Im using:

\<SCRIPT LANGUAGE=JavaScript1.1\>  
\<!–  
function detect\_flash {  
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=“images/logos2.swf”\> \<PARAM NAME=quality VALUE=high\> \<PARAM NAME=bgcolor VALUE=#FFFFFF\> ‘);  
document.write(’ \<EMBED src=“images/logos2.swf” quality=high bgcolor=#FFFFFF ‘);  
document.write(’ swLiveConnect=FALSE WIDTH=“463” HEIGHT=“146” 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(’\<IMG SRC=“images/noflash.gif” WIDTH=“463” HEIGHT=“146” usemap=”#script" BORDER=0\>’);  
}  
//–\>  
\</SCRIPT\>

Thanks  
Melissa

---

<div class="post-metadata">

### Author: ![dreeft](https://avatars.discourse-cdn.com/v4/letter/d/5f9b8f/32.png) [@dreeft](https://forum.kirupa.com/u/dreeft)
#### Post date: [March 29, 2006, 5:12am UTC](https://forum.kirupa.com/t/flash-detection-in-javascript/183649/2 "2006-03-29T05:12:03Z")

</div>

You might be best to consider using a different detection script, rather than trying to reinvent the wheel.

Here are a couple of alternatives:  
[http://www.skyzyx.com/scripts/flash.php](http://www.skyzyx.com/scripts/flash.php)  
[http://blog.deconcept.com/flashobject/](http://blog.deconcept.com/flashobject/)

---

<div class="post-metadata">

### Author: ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)
#### Post date: [March 29, 2006, 5:20am UTC](https://forum.kirupa.com/t/flash-detection-in-javascript/183649/3 "2006-03-29T05:20:41Z")

</div>

Yeah, flashObject is great. 😉

---

<div class="post-metadata">

### Author: ![leisuresuitlissy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/leisuresuitlissy/32/2109_2.png) [@leisuresuitlissy](https://forum.kirupa.com/u/leisuresuitlissy)
#### Post date: [March 30, 2006, 1:58am UTC](https://forum.kirupa.com/t/flash-detection-in-javascript/183649/4 "2006-03-30T01:58:36Z")

</div>

Yar thanks. That’s what I did in the end…  
:shifty:
