We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

catchamonkey on 01/24/08


Tagged

javascript ie flash


Versions (?)


Who likes this?

4 people have marked this snippet as a favorite

catchamonkey
adix
SpinZ
wizard04


Getting rid of the "Click here to activate" Flash annoyance


Published in: JavaScript 


Get rid of the "click here to activate" using a little javascript.

  1. // create a .js file with the following replacing the appropriate content
  2. // ensuring each document.write spans one line only, save this as flashfix.js
  3.  
  4. function RunFlash()
  5. {
  6. document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="660" height="211">\n');
  7. document.write('<param name="movie" value="images/flash.swf" />\n');
  8. document.write('<param name="quality" value="high" />\n');
  9. document.write('<param name="wmode" value="transparent" />\n');
  10. document.write('<embed src="images/flash.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="660" height="211"></embed>\n');
  11. document.write('</object\n');
  12. }
  13.  
  14.  
  15. // include this javascript in the head of the document you need it on.
  16.  
  17. // then in the right place in your html use the following to display the flash.
  18.  
  19. <script type="text/javascript">RunFlash();</script>
  20.  
  21. // If you find it isn't working you may want to check the following basic things.
  22.  
  23. // ensure the path to the .js file is correct in the head
  24. <script type="text/javascript" src="/js/flashfix.js"></script>
  25.  
  26. make sure each line in the js (each document.write) is on it's own line, that caught me out once.

Report this snippet 

You need to login to post a comment.