I think the problem is that you need to create a wmode="opaque" attribute inside of the embed tag AS WELL AS add a param element with wmode set to "opaque." While Grant Wagner's code is effective at adding the wmode="opaque" as a param inside the object, it does not add it as an attribute in the embed tag. You need them both if you want this to work cross-browser, cross-platform. That might be why Grant Wagner is seeing it work, while patricksweeney is not.
Josh Fraser wrote a nice function that rewrites the embed tag to include the wmode attribute. soooooo I combined Grant Wagner's solution for adding the wmode param, and Josh Fraser's solution for adding a wmode attribute to the embed in one function, and it looks a little something like this:
function fix_flash() {
// loop through every embed tag on the site
var embeds = document.getElementsByTagName('embed');
for(i=0; i<embeds.length; i++) {
embed = embeds[i];
var new_embed;
// everything but Firefox & Konqueror
if(embed.outerHTML) {
var html = embed.outerHTML;
// replace an existing wmode parameter
if(html.match(/wmode\s*=\s*('|")[a-zA-Z]+('|")/i))
new_embed = html.replace(/wmode\s*=\s*('|")window('|")/i,"wmode='opaque'");
// add a new wmode parameter
else
new_embed = html.replace(/<embed\s/i,"<embed wmode='opaque' ");
// replace the old embed object with the fixed version
embed.insertAdjacentHTML('beforeBegin',new_embed);
embed.parentNode.removeChild(embed);
} else {
// cloneNode is buggy in some versions of Safari & Opera, but works fine in FF
new_embed = embed.cloneNode(true);
if(!new_embed.getAttribute('wmode') || new_embed.getAttribute('wmode').toLowerCase()=='window')
new_embed.setAttribute('wmode','opaque');
embed.parentNode.replaceChild(new_embed,embed);
}
}
// loop through every object tag on the site
var elementToAppend = document.createElement('param');
elementToAppend.setAttribute('name', 'wmode');
elementToAppend.setAttribute('value', 'opaque');
var objects = document.getElementsByTagName('object');
for (var i = 0; i < objects.length; i++) {
var newObject = objects[i].cloneNode(true);
elementToAppend = elementToAppend.cloneNode(true);
newObject.appendChild(elementToAppend);
objects[i].parentNode.replaceChild(newObject, objects[i]);
}
}
window.onload = fix_flash;
It's a little bit of code, but it works very well, and it saved me from hours of pulling out my hair.