Topic: How to detect JavaScript and Flash?
Currently, i use the following for detecting JavaScript:
<noscript>
<meta http-equiv="refresh" content="0;URL=js.html" />
</noscript>And after that, some JavaScript function to detect Flash, which i proudly copied from http://www.techmug.com/detect-javascrip … sh-enabled
<script type="text/javascript">
<!--
var MM_contentVersion = 9;
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.ShockwaveFlash." & MM_contentVersion)))n');
document.write('</SCR' + 'IPT> n');
}
if ( MM_FlashCanPlay )
{
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="160" height="120">');
document.write('<param name="movie" value="animation.swf">');
document.write ('<param name="quality" value="high">');
document.write ('<param name="wmode" value="transparent">');
document.write('<embed src="animation.swf" width="160" height="120" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"></embed></object>');
} else
{
document.write('<a href="./"><img src="replaced-image.png" alt="Flash Plugin not Installed" border="0"></a>');
}
//-->
</script>My problem, being not experienced in such questions, how to easily change my HTML output based on Flash being installed or not ...
For example, i have an image that opens a JavaScript gallery - i wish that line to open the SimpleViewer gallery instead, when Flash is enabled:
Code for JavaScript:
<td>Gallery 1:<a href="Polaroids.html" target="_blank"><img src="400/Polaroid/title.jpg" alt="Polaroid.html" border="no"></a></td>Code for Flash:
<td>Gallery 1:<a href="index.html" target="_blank"><img src="400/Polaroid/title.jpg" alt="index.html" border="no"></a></td>So, based on Flash being available or not either "Polaroids.html" or "index.html" should be opened ...
Such lines would appear several times in the calling page - having multiple galleries with the same situation.
And i cannot find an easy way to do this :-(
Any idea?
Last edited by SimpleUser (2012-03-06 21:47:08)