I experienced some strange behaviour today when building a site which was using jQuery and SWFObject. Our Flash files were loading ok and 99% of the javascript (using jQuery) was working fine.
The problem was found only in IE (sound familiar?) with the following code:
$(document).ready(function(){
$('#submitButton').click(function(){
When the ‘submitButton’ was clicked, this function was not firing in IE. After some googling I found that there is a slight conflict with jQuery and SWFObject. I tested this and found the problem in jQuery 1.1.x and 1.2.1.
I found the fix on the SWFObject forums which is basically using jQuery to load the .swf:
<script type="text/javascript">
$(document).ready(function(){
var so = new SWFObject("movie.swf", "mymovie", "400", "100%", "8", "#336699");
so.addParam("quality", "low");
so.addParam("wmode", "transparent");
so.addParam("salign", "t");
so.write("flashcontent");
});
</script>
All good in all browsers

9 Comments
if you’re using already jquery, then download the media plugin to write the flash for you.
http://malsup.com/jquery/media/
Hi Tony,
The media plugin looks like it adds <object> and <embed> tags which are bad bad bad for many reasons, particularly the IE ‘click here to activate’ issue which happened when Microsoft lost the EOLAS court case a year ago.
UFO quickly became the standard for embedding Flash, then SWFObject. The authors for both those methods are now working together on a new way to embed Flash etc which I believe doesn’t rely on javascript.
Anyway, check out SWFObject for more info here: http://blog.deconcept.com/swfobject/
Michael,
Any JS plugin that manages media adds object/embed tags to the DOM. That exactly what happens when you execute this line in your code:
so.write(“flashcontent”);
The jQuery Media Plugin just makes working with media simpler and handles many, many media types beside Flash. It even uses SWFObject if that script is loaded.
Cheers!
@Malsup – Ohhh nice! I just read (a little further than before) up on the media plugin. Man it is nice.
Thanks for the comment and the info, much appreciated
ahhhhh. thanks for posting this. i was … losing it.
Thank you so much !
I was searching a patch that make jquery and swfobject working together and yours is fantastic !
(sorry for my english, i’m french geek girl)…
@Jordan/@Aurore – Glad it helped
Hi Michael,
sorry to borrow You but I see your post into TINY slideshow.
Do You resolve the conflict with jquery core?
Thanks
Ale
Typeface.js(http://typeface.neocracy.org/) doesn’t load with SWFObject attached,
but this solved the problem. Thank you so much!