Skip to content


Subversion checkout URL

You can clone with
Download ZIP


IE8 and after print #58

dragosu opened this Issue · 6 comments

4 participants


I was getting a strange behaviour when using the print version (on a complex page with dynamic content scrolling - instead of page reload) I guess .. probably because of the page complexity, but after print preview in IE8 a blank page was show instead of the content. Sorry I cannot provide the page itself. But to make it 'work' I had to execute 'after print' code with a delay.

ownerWindow.attachEvent('onafterprint', function() {
  var fnc = function(){
    // remove wrappers, leaving the original elements, and remove the shived style sheet
   // my code >>
    if (_g_after_print)
    // << my code
  window.setTimeout(fnc, 500);

This was a quick 'fix', did not try to see why (and when) this can happen .. but it just worked for me.
I used there '_g_after_print' just to scroll the content to the right position as It was changed by the 'html5shiv' on the way.


This defect occurred for my website too. The line shivedSheet.removeNode(true) froze IE8. CPU usage went up to 100% and the webpage appeared blank and white.

Based on @dragosu's solution, I have placed that particular line in a setTimeout.

ownerWindow.attachEvent('onafterprint', function() {
  // remove wrappers, leaving the original elements, and remove the shived style sheet
  setTimeout(function() {
  }, 500);

The setTimeout solution by @keeganstreet can also cause some problems, so I can't change the script to this. I really need a testcase. If one those pages is now online. I would like to have a link. (Even if you fixed it by changing the source of your html5shiv). You can also send me an email.


I can't share this particular website but I will try to recreate the defect separately.


@aFarkas I've been able to track this issue down to a crazy mix of things...

Please check this testcase:

Some notes:

  • The css file is inside a folder. If it's at the same level as the html file, I can't repro.
  • The nobile-webfont.eot file doesn't exist. If I create that file (just an empty file with that name), results were random for me (sometimes can repro, sometime can't)
  • This will only happen in native IE8. Not "IE9 in IE8 mode", and probably not in IE Collection either.

FWIW, in case anyone needs an urgent fix for this, here's the minified version of @keeganstreet's workaround.

@aFarkas, it would be cool to know what kind of "some problems" you're referring to, so we can more actively look for them. The setTimeout fix seems to be working OK in our tests.


Many thanks to all of you guys, especially for the testcase and for the code fix.

@aFarkas aFarkas closed this
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.