Read the latest web development and design tips at Fred Wu's new blog! :-)
Poke me on GitHub

jQuery problems in IE? It could be SWFObjects.

So your jQuery/JavaScript code doesn’t have any errors, yet your site isn’t working as expected in Internet Explorer? It could be that you have some SWFObject code interfering with your jQuery code (if for example, you’re using a Flash video player or something along those lines). The solution is very simple. Simply enclose your SWFObject code in a jQuery $(document).ready() as so:

<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>

The only downside to this is that if you have some alternate HTML to show when Flash isn’t present, this text will be shown until the document is fully loaded and the player(s) start to render (even if the user does in fact have Flash installed).

  • Digg
  • DZone
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter

Related posts

Tags: , , ,

Comments Section

5 Responses to “jQuery problems in IE? It could be SWFObjects.”

Sidebar might be covered by comments ... consider it a feature! ;)
  1. 1

    Thanks for the note. I may bump into the problem later with my own website. I plan to add some flash videos on my jQuery pages when I have time.

  2. 2

    Hi Ming. Thanks for your comment. Hope the post helps save you some time :) Would love to hear what you and the other readers are working on.

    Cheers,
    Scott

  3. 3

    Thanks for posting this. Was scratching my head there for a bit but this solved it!

  4. 4

    keep up the great piece of work, I read few content on this site and I conceive that your website is rattling interesting and contains lots of excellent info .

  5. 5

    Thanks.. helps me a lot.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>