«

»

Aug 30 2011

Flash advert disappers in IE9

The Flash banners with streaming video disappeared in IE9, but I discovered that resizing the window width by 1 pixel (+/-) and reloading the page removed the problem. I believe this is related to the “Flash off by 1 pixel” problem.

I tried a ton of settings in IE9 and Flash – disabling accelerated graphics etc., but with no effect.  And to be honest, I didn’t really care about these settings anyway, since the users of the online media can’t be forced to change their settings just to see the ads…

I came up with the idea of resizing the <html> element of the webpage (of course only when displaying this ad). Luckily enough, the media uses jQuery, which saved me some work.

But jQuery("html").width(xxxx); was no lifesaver, since this is either not allowed or ignored by IE9. One of our skilled freelancers (credits, Claus Conrad) came up with jQuery("html").get(0).style.width = xxxx + "px";. This fortunately did the trick.

The final script ended up as this:

jQuery(document).ready(function() {
  // this exact bug is only in IE9, however different odd/even 
  // Flash bugs exists in other browsers
  if (!(jQuery.browser.msie && jQuery.browser.version=="9.0")) return;
  var x = jQuery("html").width();
  if (x%2 == 1)
  {
    x--;
    jQuery("html").get(0).style.width = x + "px";
  }
});

This trick might also help on “Flash off by one pixel” problems in Firefox. Not tested though.

1 comment

  1. Claus Conrad

    Thanks for the credit – and reminding me of the solution, now that I needed it again 🙂

    If this if of interest to anyone, the problem doesn’t appear when the Themes service is deactivated or not available (e. g. on Windows Server), even though the IE and Flash versions are identical. It scares the hell out of me that rendering engines behave differently depending on such factors :/

    // Claus

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>