When run in IE 8, this code yields an exception with “Invalid argument.” as description and message, and this number: -2147024809
I’m using latest (1.7.1) jQuery. Is this a known bug? How to resolve?
var objs=$('object').not('object param[name="wmode"][value="transparent"]');
var appended = $('<param name="wmode" value="transparent"></param>');
objs.prepend(appended);
Html snippet:
<object width="Width in Pixels" height="Height in Pixels" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0">
<param name="salign" value="lt">
<param name="quality" value="high">
<param name="scale" value="noscale">
<param name="movie" value="http://geekfile.googlepages.com/flvplay.swf">
<param name="FlashVars" value="&streamName=FLV_Video_URL&skinName=http://geekfile.googlepages.com/flvskin&autoPlay=true&autoRewind=true">
<embed width="Width in Pixels" height="Height in Pixels" flashvars="&streamName=FLV_Video_URL&autoPlay=true&autoRewind=true&skinName=http://geekfile.googlepages.com/flvskin" quality="high" scale="noscale" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="http://geekfile.googlepages.com/flvplay.swf" wmode="transparent">
</embed>
</object>
The error occurs on jquery.js line 5771:
this.insertBefore( elem, this.firstChild );
Update: This is not “a jQuery issue” – it happens with raw javascript.
function handle(object) {
var html = object.innerHTML;
// The following line throws an exception:
// Also, 'html' is not empty or undefined at this point.
object.innerHTML = '<param name="wmode" value="transparent"></param>' + html;
}
I’m not 100% sure about this off the top of my head, but encountered something like this before, and it was specific to the
<object>tag. IE does not see this as part of the html dom, so manipulation with jquery returns a null object. The solution I remember working was html5shiv like, create an object element and append the param as a string instead of a jQuery object and all should be well.Alternatively, you could wrap the flash in a div, then get that div’s inner html, append to that html, then drop it back into the wrapper div.