/ Published in: JavaScript
Also we can use HTTP_ACCEPT
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script language="javascript"> var plugin; var version = 5; var flash = false; if (navigator.plugins) { if (navigator.plugins["Shockwave Flash"]) { plugin = navigator.plugins["Shockwave Flash"].description; flash = parseInt(plugin.charAt(plugin.indexOf('.') - 1)) >= version; } else { if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) { var vb = '<script language="vbscript">\n' + ' on error resume next\n' + ' flash = IsObject(CreateObject(\n' + ' "ShockwaveFlash.ShockwaveFlash.' + version + '"))\n' + '<' + '/script>'; document.write(vb); } } } if ( flash ) { // write flash code document.write('<object>...</object>'); } else { // alternative image code document.write('<img src=""/>'); } </script>