Skip to content

IE8 crash when using a body background image #501

necolas opened this Issue Feb 14, 2012 · 15 comments
necolas commented Feb 14, 2012

I'm experiencing a hard crash running Modernizr 2.5.2 in IE8 (Windows XP) under these circumstances:

  1. Include styles before Modernizr (as recommended)
  2. Include a background image on the body
  3. Include Modernizr with a test like "generated content".

Reduced test case:

That test case includes a build of Modernizr containing just the generated content test as an example of the type of test that crashes IE8 - not all tests do; I think only those that involve style/dom injection.


Edit: Potential fix (via similar jQuery resolved-bug -

Fixed example:

Fixed by adding background: none to the injected <style> block for the fake body


Confirmed here. IE8 crashes upon loading the test case.


Ran your test case in Win XP/IE8, and it crashed the browser


Crashes IE8 on windows xp. Today I experienced hard crashes on IE7/Vista as well with Modernizr 2.5.2.
Didn't have time to setup an isolated test to find what's causing it though.

necolas commented Feb 14, 2012

A fixed jQuery bug is related:

This Modernizr bug is also fixed by adding background: none to the injected <style> block for the fake body

IE8 test case with crude fix:


Hmm tested this on browserstack and everything is working on IE6,7 and 8. Not sure how relevant browserstack setup is for this bug?


Well I tested this on Windows XP/IE8 (IE6 is default browser but IE7 and IE8 installed via method) and the page/browser didn't crash for me.


With an un-primed cache, the test case does not crash IE8 on Windows XP for me. When the cache is primed, however, it crashes every time.

Modernizr member

Can confirm this crashes IE8, interestingly setting background:0 also stops it crashing can someone try this and confirm it stops the crashing.

necolas commented Feb 14, 2012

Ryan, that doesn't crash for me seems to act like background-position: 0 50%. Anything to explicitly set a valid background on the temporary body works. Hopefully this can get patched soon :)

Modernizr member

nicolas thank you so much for kicking this off with a reduced testcase. :)

@aFarkas aFarkas added a commit that referenced this issue Feb 15, 2012
@aFarkas aFarkas fix issue #332 and issue #501 971dba3
Modernizr member

Modernizr 2.5.3 has shipped which fixes this issue.

@KuraFire KuraFire closed this Feb 17, 2012
brgrz commented Apr 4, 2012

This is still happening to me with version 2.5.3 with respond 1.1.0 from Initializr package. The same cause: background on the body tag in linked CSS file.

Modernizr member

It's actually the matchMedia polyfill it includes in the build when you check respond. Modernizr has fixed that issue the one initializer includes has not.

Initializer is actually doubling up as the build of Modernizr they include already has a matchMedia polyfill via which also handles the background crashing issues for IE8.

cc @verekia

pdjota commented May 15, 2012

I had the same issue, I had to regenerate back to 2.0.6.

verekia commented May 15, 2012

It should have been fixed 2 days ago. Can someone verify?


@phistuck phistuck added a commit that referenced this issue Aug 31, 2012
@phistuck phistuck fix issue #332 and issue #501 d08f703
@patrickkettner patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue Feb 22, 2015
@aFarkas aFarkas fix issue #332 and issue #501 23b9ff9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.