Jake Archibald 08 December 2011 @Matt: Good point about the screen width vs browser width thing. Although that’s another drawback, responding to browser viewport size is much preferable. Detecting screen width is flakey in many devices. Eg, ask an iphone for its screen width when it’s in landscape vs portrait mode, you’ll get the same result. Completely agree that my solution is probably too dirty to use. Tempting though, isn’t it? @Pete Jones: Bruce Lawson covers some possible ideas @Gunnar: document.write is a no-go in XHTML isn’t it? Or did they fix that? Well spotted on the typo, is fixed now. @Yoav: Agree. I hope I flagged that enough in the article. What “extreme conditions” are you thinking of? I thought the effect would be minimal because the scripts are inline and parse & execution time should be minimal.