Jump to content

How to detect if flash is installed? Cant find bug from my script.


rain13

Recommended Posts

My script says "Flash installed" even if it's not installed. Does anyone know why it lies? My target is IE (since I wrote program that uses embedded IE) and it must work with old IE such as IE 6.Does anyone know how I should modify my code to detect if flash ins installed/supported.

<HTML><HEAD><script LANGUAGE="JavaScript">function flash(){<!-- use this comment tag to hide the enclosed code from old browsers.//Look for a version of Internet Explorer that supports ActiveX (i.e., one that's//running on a platform other than Mac or Windows 3.1) or a browser that supports//the plugin property of the navigator object and that has Flash Player 2.0//installed.if ((navigator.appName == "Microsoft Internet Explorer" &&	navigator.appVersion.indexOf("Mac") == -1 &&   navigator.appVersion.indexOf("3.1") == -1) ||	(navigator.plugins && navigator.plugins["Shockwave Flash"])					   || navigator.plugins["Shockwave Flash 2.0"]){   //Load a pre-defined HTML page with Flash Player in it into the browser window.	document.write("Flash installed");}else {	//Load a pre-defined HTML page without Flash Player into the browser window.	document.write("Flash not installed");}// Close the comment tag. -->}</SCRIPT></HEAD><body onload="flash();"></BODY></HTML>

Link to comment
Share on other sites

yikes. what about something a bit simpler and neater?http://www.alistapart.com/articles/flashsatay/they used an image, but you could substitute it with text.
got this code from there, but it doesnt show me anything. even if i have flash instlled.
<HTML><body><objectclassid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"width="400" height="300" id="movie" align=""><param name="movie" value="movie.swf"><embed src="movie.swf" quality="high" width="400"height="300" name="movie" align="" type="application/x-shockwave-flash"plug inspage="http://www.macromedia.com/go/getflashplayer"> </object></BODY></HTML>

Link to comment
Share on other sites

did you literally copy/paste that from the beginning of the page? I take it you really didn't read the article then? The idea behind the method as explained is that you can show a flash file if it's installed, else, it will show user feedback. The final deconstructed code snippet is found at the bottom article, typically arrived upon if one reads the whole article. If that's not of use to you, then explain what you are trying to do, if it's something more complex then just being able to tell the user wether they have flash installed or not.

Link to comment
Share on other sites

@thescientist thanks for hint and sorry for not not reading entire article fist time. I'll do it this time. My goal is simple if flash is supporter then display"flash supported" else "flash not supported". It's just needed for my program that works with IE to tell if it should download and install flash.@justsomeguy thanks for links.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...