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:
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:
All good in all browsers ![]()
if you’re using already jquery, then download the media plugin to write the flash for you.
http://malsup.com/jquery/media/
tony petruzzi
September 28th, 2007
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 Sharman
September 29th, 2007
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
September 29th, 2007
@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
Michael Sharman
September 29th, 2007
ahhhhh. thanks for posting this. i was … losing it.
jordan
November 28th, 2007
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)…
Aurore
December 17th, 2007
@Jordan/@Aurore - Glad it helped
Michael Sharman
December 18th, 2007