ASU Web Community

prevent click to activate activex control

Sunday, March 11th, 2007 - 11:59 pm
  • admin

Does anyone a script to prevent a .swf file or other activex control on a site from having to be clicked before running?

 

Monday, March 12th, 2007 - 8:01 am
  • tclemen1
  • tclemen1's picture

This usually occurs on flash objects, video clips or anything with activeX plug-in content. The simplest way around it is to write out the <object> and <embed> tags at run time. What this means is write them out on the page with JavaScript, this will fix the annoying "click here to do something". See Example below

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab##version=7" width="544" height="476">So above is my typical object tag how we have all written them since time immemorial. Now to get around the activeX problem do the following

<script type="text/javascript">
function insertFlash()
{
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab##version=7" width="544" height="476">\n');
}
</script>

In the above code we use the document.write to write the tag onto the page, the \n is used at the end of the line to begin a new one. In the example I only did one line, you'll need to write the entire call this way.

Then where you want your object to appear call the insertFlash() function on your page.
<script src="/scripts/flashcall.js" language="JavaScript" type="text/javascript"></script>

Tuesday, March 13th, 2007 - 3:29 pm
  • admin

I will try this tonight and let you know how it goes! Thanks!

Thursday, August 23rd, 2007 - 11:31 am
  • kdmarks
  • kdmarks's picture
Thursday, August 30th, 2007 - 1:39 pm
  • mkrapp
  • mkrapp's picture

I used the following info to remove the "click to activate" from the graph section of DARS Interactive Audits a while back. It seems to work well:

http://www.amarasoftware.com/flash-problem.htm