gavin26er Posted December 2, 2005 Share Posted December 2, 2005 hi guys i have this code and it works great i have it diplaying an swf file but if the user don't have flash it defaults back to a jpg. what i want it to do is detect that you don't have flash and prompt you and ask you if you want to download it, and then if you say no if jumps to the jpg. the code is below.script type="text/javascript"><!--var flashInstalled = false;var isIE = (navigator.userAgent.indexOf("MSIE") != -1) ? true : false; var isWin = (navigator.userAgent.indexOf("Win") != -1) ? true : false;if (navigator.plugins && navigator.plugins.length){var x = navigator.plugins["Shockwave Flash"];if (x){if (x.description){y = x.description;var flashVersion = y.charAt(y.indexOf('.')-1); //checks flash versionif (flashVersion>=6){ //checks for version 6 and above.flashInstalled = true;}}}}if(isIE && isWin){ //can't read from plugins array on ie pc...document.write('<scr' + 'ipt language=VBScript> \n');document.write('on error resume next \n');document.write('flashInstalled = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n'); document.write('flashInstalled = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n'); document.write('flashInstalled = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n'); document.write('<\/scr' + 'ipt> \n');}if (flashInstalled){document.write ('<object type="application/x-shockwave-flash" data="../menus_logos/logo.swf" width="760" height="120">');document.write ('<param name="movie" value="../menus_logos/logo.swf" width="760" height="120" quality="high" menu="false" />');document.write ('<\/object>');}else {document.write ('<img src="../menus_logos/top_banner.jpg" class="top" width="760" height="120"/>');}//--></script> Link to comment Share on other sites More sharing options...
Chocolate570 Posted December 2, 2005 Share Posted December 2, 2005 Are you sure this hasn't been taken from another forum topic? I'm sure that I answered this question. :S <script type="text/javascript"><!--var flashInstalled = false;var isIE = (navigator.userAgent.indexOf("MSIE") != -1) ? true : false;var isWin = (navigator.userAgent.indexOf("Win") != -1) ? true : false;if (navigator.plugins && navigator.plugins.length){var x = navigator.plugins["Shockwave Flash"];if (x){if (x.description){y = x.description;var flashVersion = y.charAt(y.indexOf('.')-1); //checks flash versionif (flashVersion>=6){ //checks for version 6 and above.flashInstalled = true;}}}}if(isIE && isWin){ //can't read from plugins array on ie pc...document.write('<scr' + 'ipt language=VBScript> \n');document.write('on error resume next \n');document.write('flashInstalled = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');document.write('flashInstalled = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');document.write('flashInstalled = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');document.write('<\/scr' + 'ipt> \n');}if (flashInstalled && confirm("Do you want to download this flash movie?")){document.write ('<object type="application/x-shockwave-flash" data="../menus_logos/logo.swf" width="760" height="120">');document.write ('<param name="movie" value="../menus_logos/logo.swf" width="760" height="120" quality="high" menu[COLOR=DarkGreen]="false" />');document.write ('<\/object>');}else {document.write ('<img src="../menus_logos/top_banner.jpg" class="top" width="760" height="120"/>');}//--></script> Link to comment Share on other sites More sharing options...
gavin26er Posted December 2, 2005 Author Share Posted December 2, 2005 i took the exact code you had there and replaced mine but it didn't work, nothing happened. Link to comment Share on other sites More sharing options...
Chocolate570 Posted December 2, 2005 Share Posted December 2, 2005 Can you give me a link to your site? I'd be able to check out what you're doing wrong there. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now