This is what I'm doing - it's taken from the swfobject and modified slightly:
function removeObjectInIE(el) {
var jbo = (typeof(el) == "string" ? getElementById(el) : el);
if (jbo) {
for (var i in jbo) {
if (typeof jbo[i] == "function") {
jbo[i] = null;
}
}
jbo.parentNode.removeChild(jbo);
}
}
function removeSWF(id) {
var obj = (typeof(id) == "string" ? getElementById(id) : id);
if(obj){
if (obj.nodeName == "OBJECT" || obj.nodeName == "EMBED") {
if (ua.ie && ua.win) {
if (obj.readyState == 4) {
removeObjectInIE(id);
}
else {
$(document).ready(function() { removeObjectInIE(id); });
}
}
else {
obj.parentNode.removeChild(obj);
}
}else if(obj.childNodes && obj.childNodes.length > 0){
for(var i=0;i<obj.childNodes.length;i++){
removeSWF(obj.childNodes[i]);
}
}
}
}
So you would then do removeSWF("mydiv");
- You'd probably want to rewrite this in a jQuery manner, this is taken from a library I am working on where I can't be certain jQuery will be there. (I replaced my on ready function with the $().ready())