dotjay.co.uk

17 January 2006 : FOUC Mac: something to note

A problem with a clients’ site yesterday reminded me something… sometimes it’s not about what’s there, but what’s not there.

Simple, huh?

A client was reporting a problem where their site wasn’t displaying properly in Internet Explorer for Mac – typical! I thought it was probably a CSS problem, or maybe I’d missed a check for IE for Mac in my JavaScript.

I checked the site and it was taking pretty much exactly 3 minutes to load each page. I commented out my main style sheet and the JavaScript file. The problem was still there. Hmm…

I eventually commented out most of the head to find out that the problem was with the blank print style sheet I put in to avoid the flash of unstyled content (FOUC) in IE on Windows, at least, until I got around to doing a print style sheet.

I’m not sure how many times I’ve stumbled across and read Dave Shea’s CSS cribsheet but down there near the bottom is this:

Don’t link to empty style sheets as ‘placeholders’ for future style sheets (like handheld or print media style sheets).
Mac IE5 chokes on the empty style sheet and the page load time increases. Instead, have at least one rule (or perhaps even a comment) in the style sheet so that MacIE doesn’t choke.

Heh – a bug in IE for Mac which does not tolerate an empty style sheet, an empty style sheet being a fix for a bug with IE for Windows. Go figure!

What to do?

Well, that’s easy: follow Dave’s advice. If you’re not ready to write your print style sheet yet, just putting a comment in the file fixes this issue.

3 Comments

Comment 1

Thanks for the timely reminder – I’d forgotten about this one (and could easily see myself doing this kind of thing!)

Ian Lloyd, 18 January 2006 at 1530

Comment 2

Doesn’t an link to an empty .js script file avoid the FOUC as well? That’s what I’ve always used, rather than a dummy print stylesheet.

Matthew Pennell, 21 January 2006 at 2101

Comment 3

Matt: yes, an empty JavaScript file solves the problem too.

I’ve just tested it with IE for Mac as well, just in case, but it doesn’t appear to cause any problems. The .js file doesn’t even have to exist it seems.

Cheers.

dotjay, 26 January 2006 at 2123

Commenting is closed for this entry, but please contact me to share your thoughts.

Jon Gibbins is a web developer and accessibility geek; dotjay.co.uk is his online home.

Associating

Site Information

dotjay.co.uk is published with Textpattern. There are feeds.

Copyright

© 2004–2008 Jon Gibbins (dotjay). Some rights reserved.

Except where otherwise noted, content on this site has a Creative Commons License.