Forum Moderators: open
I have changed the flash headers on 2 sites to write out the embed tags using an external JavaScript. Both sites seem fine 90% of the time but every now and again the 'click to active and use this control' message comes back. I have checked to make sure I wasn't getting a cached page and viewed the source to make sure no embed tag was in the source (except for in the external JavaScript file)
A browser restart seems to fix it and 'click to active and use this control' disappears again.
Could this a bug in the IE 6 patch? Is there better solution to remove the 'click to active and use this control' messages? Has anyone found this happening in IE 7 beta yet?
Is there better solution to remove the 'click to active and use this control' messages?
That is the recommended method -- the only one I've heard of in fact.
Step 1:
Create a file called activeX.js
Paste the following code into that file:
// Attach this to the onload event handler to make sure all of the items
// we're activating are available via the DOM.
function activateActiveX()
{
var activeXObjTypes = new Array( "applet", "embed", "object" );
for ( var i = 0; i < activeXObjTypes.length; i++ )
{
var xObj = document.getElementsByTagName( activeXObjTypes[i] );
for( var j = 0; j < xObj.length; j++ )
{
xObj[j].outerHTML = xObj[j].outerHTML;
}
}
}
Step 2:
In the <head> of your HTML document that contains <object>, <embed>, or <applet> elements, paste the following code:
<script type="text/javascript" src="activeX.js"></script>
<script type="text/javascript">
window.onload = activateActiveX;
</script>
This method does not require that you replace all of your existing objects with a <script> in the middle of your document. Also, for users with JavaScript disabled, they'll still get your ActiveX (though they will still need to click to activate).
<script type="text/javascript" src="swfobject.js"></script> <div id="flashcontent">This text is replaced by the Flash movie.</div> <script type="text/javascript">
var so = new SWFObject("movie.swf", "mymovie", "200", "100", "7", "#336699");
so.write("flashcontent");
</script>
The method I propose does NOT require rewriting your documents. Much cleaner and easier to implement, in my opinion.
Very few visitors support Flash but not JS. Programmed correctly, a page with JS Flash insertion will still show valuable information even when JS/Flash isn't available.
Eliminating validation errors.
Presumably you mean because certain elements, like <applet> are depreciated?
Improving accessibility with alternative content
Alternative content should still be applied using the "alt" attribute of your ActiveX controls, so there's no accessibility benefit with the SWFObject method.
Search engine obtimization via the alternative content
Again, alternative content should be applied to your ActiveX objects anyway, so there's no extra benefit with the SWFObject method.
Very few visitors support Flash but not JS. Programmed correctly, a page with JS Flash insertion will still show valuable information even when JS/Flash isn't available.
Yes, but my method will still show the Flash for ALL users, even those with JS disabled.
I finally decided to use SWFObject. Here's my code, that also deals with the case where javascript is disabled:
<div id="flashcontent">
<noscript>
<object type="application/x-shockwave-flash"
data="movie.swf"
width="740"
height="130">
<param name="movie" value="movie.swf" />
</object>
</noscript>
</div>
<script type="text/javascript">
<!--
var so = new SWFObject("movie.swf", "demo", "740", "130", "8", "#FFFFFF");
so.write("flashcontent");
//-->
</script>