Wednesday, April 22, 2009

Internet Explorer 7, Print Preview Page Generator


I found a bug (or at least what I think is a bug in Internet Explorer 7.  Here’s the scoop: when you print preview a page in IE7, you get a nice little popup of the page(s) and how it will print.  Great.  Well depending on how the page is created, it might not work.  Down at the bottom of the preview it gives you a “Page 1 of X” (where X is the total number of pages).  As you can see from the image, the number of pages is 2076, but what you cannot see is that it is still increasing…  doh! 

Under certain circumstances you can make the function that calculates the total number of pages to print to “freak out” or rather infinitely loop, thus never displaying the actual preview of the page.  This is only an issue in IE7.  The same test works fine in Firefox 2.0.0.6.  I have not yet tested it in any other browser or version of a browser.

 

I have not completely narrowed down the issue yet either.  But I have found that if you use DIV tags and a CSS style sheets to layout your pages, you may come across this issue.  Some facts: this page is built dynamically.  My div tags are all fixed width.  There are nested div elements up to 3 or 4 levels, and there are label elements with empty “for” attributes.  All the layout is done using the style sheet and div attributes.  The interesting thing is that this issue only happens on pages that are longer than about 2 print preview pages; which means that it seems to either be the data in the elements, or the number of elements on the page. 

 

First, I made sure that all my tags had appropriate closing tags and formatting (text case and all that).  I threw it into Visual Studio 8 and formatted and validated the text.  Same issue.  Next, I started from the bottom of the page and started commenting out the div blocks one by one and testing the print preview after each.  After commenting out two of them, the issue went away and the print preview displayed fine.  So I thought there must be something wrong with one of these divs.  Turns out that there is nothing wrong with them.  I found that I could uncomment those divs and comment out the first few divs and the problem would also be resolved.  So then I uncommented all the divs again (essentially restoring the problem), and removed the CSS stylesheet reference.  Again the problem went away.

 

Okay, now this is messin’ with my brain…. 

 

So ultimately, I submitted the issue to Microsoft.  Right now, this currently looks like a bug.  I found the following article on MSDN: http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/5defae18-1e29-4f75-a47c-670c82ab15de and submitted my issue there.  The original issue was reported in 2008, so I’m not sure if anyone is still tracking the problems.  If you have any solutions to this issue please post your comments here.  I still need to resolve this issue.  Thanks!


The problem is resolved in the latest version of Internet Explorer 8.

No comments:

Post a Comment