<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Browser Performance Problem with CSS &quot;print&quot; Media Type</title> <atom:link href="http://zoompf.com/blog/2009/12/browser-performance-problem-with-css-print-media-type/feed" rel="self" type="application/rss+xml" /><link>http://zoompf.com/blog/2009/12/browser-performance-problem-with-css-print-media-type</link> <description>Next Generation Web Performance</description> <lastBuildDate>Wed, 16 May 2012 13:49:16 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>By: Abstract Sequential - Print Styles Are Responsive Design</title><link>http://zoompf.com/blog/2009/12/browser-performance-problem-with-css-print-media-type#comment-7698</link> <dc:creator>Abstract Sequential - Print Styles Are Responsive Design</dc:creator> <pubDate>Thu, 15 Mar 2012 07:26:34 +0000</pubDate> <guid
isPermaLink="false">http://zoompf.com/blog/?p=226#comment-7698</guid> <description>[...] it has loaded a style sheet with the media type of print. #seriously #testyours. This article on Browser Performance Problem with CSS &#8220;print&#8221; Media Type outlines the problem really [...]</description> <content:encoded><![CDATA[<p>[...] it has loaded a style sheet with the media type of print. #seriously #testyours. This article on Browser Performance Problem with CSS &#8220;print&#8221; Media Type outlines the problem really [...]</p> ]]></content:encoded> </item> <item><title>By: Web Pages That Suck learn good web design by looking at bad web design -- The Daily Sucker</title><link>http://zoompf.com/blog/2009/12/browser-performance-problem-with-css-print-media-type#comment-27</link> <dc:creator>Web Pages That Suck learn good web design by looking at bad web design -- The Daily Sucker</dc:creator> <pubDate>Tue, 16 Feb 2010 11:53:03 +0000</pubDate> <guid
isPermaLink="false">http://zoompf.com/blog/?p=226#comment-27</guid> <description>[...] Browser Performance Problem with CSS &quot;print&quot; Media Type (December 2009) [...]</description> <content:encoded><![CDATA[<p>[...] Browser Performance Problem with CSS &#8220;print&#8221; Media Type (December 2009) [...]</p> ]]></content:encoded> </item> <item><title>By: uberVU - social comments</title><link>http://zoompf.com/blog/2009/12/browser-performance-problem-with-css-print-media-type#comment-26</link> <dc:creator>uberVU - social comments</dc:creator> <pubDate>Wed, 03 Feb 2010 22:54:19 +0000</pubDate> <guid
isPermaLink="false">http://zoompf.com/blog/?p=226#comment-26</guid> <description>&lt;strong&gt;Social comments and analytics for this post...&lt;/strong&gt;
This post was mentioned on Twitter by zoompf: All browsers hurt Performance by downloading CSS w/ print media type even if you don&#039;t print! Problem and fix here: http://bit.ly/6pXo5E...</description> <content:encoded><![CDATA[<p><strong>Social comments and analytics for this post&#8230;</strong></p><p>This post was mentioned on Twitter by zoompf: All browsers hurt Performance by downloading CSS w/ print media type even if you don&#8217;t print! Problem and fix here: <a
href="http://bit.ly/6pXo5E" rel="nofollow">http://bit.ly/6pXo5E</a>&#8230;</p> ]]></content:encoded> </item> <item><title>By: kangax</title><link>http://zoompf.com/blog/2009/12/browser-performance-problem-with-css-print-media-type#comment-25</link> <dc:creator>kangax</dc:creator> <pubDate>Thu, 07 Jan 2010 21:47:17 +0000</pubDate> <guid
isPermaLink="false">http://zoompf.com/blog/?p=226#comment-25</guid> <description>Thanks for clarification. It is now clear to me that, for the most part, we agree with each other :)
The reason I&#039;m recommending to avoid NOSCRIPT elements is because I see them as an inferior alternative to graceful degradation. We have two ways to provide certain content to script-less clients; one — where content is present from the start, and is then hidden/removed/transformed by a script; and another — where content is stuffed into NOSCRIPT, and the job of displaying it is essentially delegated to a browser.
The problem is that SCRIPT&#039;s are known to be stripped by corporate firewalls and/or proxies, and if Javascript is enabled, NOSCRIPT-based degradation turns out to be unsuccessful. Why prefer solution that has known flaws if there&#039;s another alternative that has none and costs just as much?
Now, in this particular situation, the problem is not that apparent of course, as you rightfully explained. The subset of people who would suffer from SCRIPT removal _and_ needed to print a page is probably insignificant in a typical scenario. However, we could still try to avoid faulty NOSCRIPT.
Why not include print stylesheet the usual way (then remove it with script)? Potential problem I see here is that script would need to be positioned before link/style element. I&#039;m also not sure if downloading of stylesheet is delayed while script positioned before is executed. If it isn&#039;t, then removing element is pointless, as request might have already been sent.</description> <content:encoded><![CDATA[<p>Thanks for clarification. It is now clear to me that, for the most part, we agree with each other <img
src='http://zoompf.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>The reason I&#8217;m recommending to avoid NOSCRIPT elements is because I see them as an inferior alternative to graceful degradation. We have two ways to provide certain content to script-less clients; one — where content is present from the start, and is then hidden/removed/transformed by a script; and another — where content is stuffed into NOSCRIPT, and the job of displaying it is essentially delegated to a browser.</p><p>The problem is that SCRIPT&#8217;s are known to be stripped by corporate firewalls and/or proxies, and if Javascript is enabled, NOSCRIPT-based degradation turns out to be unsuccessful. Why prefer solution that has known flaws if there&#8217;s another alternative that has none and costs just as much?</p><p>Now, in this particular situation, the problem is not that apparent of course, as you rightfully explained. The subset of people who would suffer from SCRIPT removal _and_ needed to print a page is probably insignificant in a typical scenario. However, we could still try to avoid faulty NOSCRIPT.</p><p>Why not include print stylesheet the usual way (then remove it with script)? Potential problem I see here is that script would need to be positioned before link/style element. I&#8217;m also not sure if downloading of stylesheet is delayed while script positioned before is executed. If it isn&#8217;t, then removing element is pointless, as request might have already been sent.</p> ]]></content:encoded> </item> <item><title>By: Billy Hoffman</title><link>http://zoompf.com/blog/2009/12/browser-performance-problem-with-css-print-media-type#comment-24</link> <dc:creator>Billy Hoffman</dc:creator> <pubDate>Thu, 07 Jan 2010 16:49:09 +0000</pubDate> <guid
isPermaLink="false">http://zoompf.com/blog/?p=226#comment-24</guid> <description>Let&#039;s not throw the baby out with the bathwater! Lets discuss the problem and possible solutions separately:
Many websites do not contain print specific style information. However 100% of visitors to a website with a separate CSS file for print rules will make an HTTP request for a resource (print.css) whose content is actually used less than 100% of the visitors. Thus we have identified a performance problem for websites with a separate printer specific style data: an unnecessasry HTTP request. It does not matter whether print.css contains 3 rules or 300 rules. Its an unnecessary request and we performance junkies love to reduce HTTP reqeusts!
I believe this post has value if for only bringing this performance problem to the attention of a wider audience.
I was only able to find one published solution to this problem: concat together the print style information and use @media. This seems like a good idea and it aligns with our existing mindset of &quot;concat resources together to reduce HTTP requests.&quot;
However this solution doesn&#039;t seem like a good solution if your print.css is larger than &quot;small&quot; or if only a &quot;small&quot; subset of visitor print your webpage onto paper. In fact, it becomes a worse solution as the size of the print specific rules increases and/or as the number of users who are actually printing decreases.
So, I propose another solution that I think is kind of sexy: Using JavaScript to lazy load printer specific CSS! Which solution works for you will depend on your site design and traffic patterns the same way whether you should inline CSS and JavaScript or use external files depends on your site design and traffic patterns.
Is there a downside to the second solution? Sure. Its still 2 HTTP requests though 1 is deferred. There could be an accessibility issue (though the impact to accessibility of using JavaScript to lazy load print style information is debatable). The &lt;NOSCRIPT&gt; fallback should work just fine except:
-If you are on a site with printer specific style information in a separate file...
-and you have JavaScript enabled...
-and you are on a network with a device that is selectively removing some JavaScript...
-and it selectively removes the JavaScript that lazy loads the style sheet...
-and you decide to print that web page...
then you will not print it using the proper style rules
I don&#039;t think there will be much of a loss of life or limb because of that ;-)
I completely agree with you (and said so in the article) that if you have a small print.css then the JS solution does not make sense. You have convinced me that downloading printer information if its in a separate file at page load makes sense. The &quot;online but then go offline and print&quot; is a valid use case. As I mentioned in the article, browsers should defer downloading external printer specific style sheets until after window.onload has completed.</description> <content:encoded><![CDATA[<p>Let&#8217;s not throw the baby out with the bathwater! Lets discuss the problem and possible solutions separately:</p><p>Many websites do not contain print specific style information. However 100% of visitors to a website with a separate CSS file for print rules will make an HTTP request for a resource (print.css) whose content is actually used less than 100% of the visitors. Thus we have identified a performance problem for websites with a separate printer specific style data: an unnecessasry HTTP request. It does not matter whether print.css contains 3 rules or 300 rules. Its an unnecessary request and we performance junkies love to reduce HTTP reqeusts!</p><p>I believe this post has value if for only bringing this performance problem to the attention of a wider audience.</p><p>I was only able to find one published solution to this problem: concat together the print style information and use @media. This seems like a good idea and it aligns with our existing mindset of &#8220;concat resources together to reduce HTTP requests.&#8221;</p><p>However this solution doesn&#8217;t seem like a good solution if your print.css is larger than &#8220;small&#8221; or if only a &#8220;small&#8221; subset of visitor print your webpage onto paper. In fact, it becomes a worse solution as the size of the print specific rules increases and/or as the number of users who are actually printing decreases.</p><p>So, I propose another solution that I think is kind of sexy: Using JavaScript to lazy load printer specific CSS! Which solution works for you will depend on your site design and traffic patterns the same way whether you should inline CSS and JavaScript or use external files depends on your site design and traffic patterns.</p><p>Is there a downside to the second solution? Sure. Its still 2 HTTP requests though 1 is deferred. There could be an accessibility issue (though the impact to accessibility of using JavaScript to lazy load print style information is debatable). The &lt;NOSCRIPT&gt; fallback should work just fine except:</p><p>-If you are on a site with printer specific style information in a separate file&#8230;<br
/> -and you have JavaScript enabled&#8230;<br
/> -and you are on a network with a device that is selectively removing some JavaScript&#8230;<br
/> -and it selectively removes the JavaScript that lazy loads the style sheet&#8230;<br
/> -and you decide to print that web page&#8230;</p><p>then you will not print it using the proper style rules</p><p>I don&#8217;t think there will be much of a loss of life or limb because of that <img
src='http://zoompf.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p><p>I completely agree with you (and said so in the article) that if you have a small print.css then the JS solution does not make sense. You have convinced me that downloading printer information if its in a separate file at page load makes sense. The &#8220;online but then go offline and print&#8221; is a valid use case. As I mentioned in the article, browsers should defer downloading external printer specific style sheets until after window.onload has completed.</p> ]]></content:encoded> </item> <item><title>By: kangax</title><link>http://zoompf.com/blog/2009/12/browser-performance-problem-with-css-print-media-type#comment-23</link> <dc:creator>kangax</dc:creator> <pubDate>Thu, 07 Jan 2010 07:03:57 +0000</pubDate> <guid
isPermaLink="false">http://zoompf.com/blog/?p=226#comment-23</guid> <description>&quot;This is very silly behavior. Especially given that virtually none of your website visitors are going to print any of your web pages, unless you are a website like Google Maps. &quot;
It was amusing to read this line off of a printed version of this post, during lunch, few days ago :)
I think the &quot;problem&quot; with print stylesheets is generally not that severe, and some of the advise given here is somewhat harmful when employed on the public web.
First of all, it&#039;s hard to imagine a print stylesheet of a large size. Not in a typical scenario. In my experience, print stylesheets usually consist of a rather small set of rules; rules that mainly cancel out some of the screen formatting. &quot;A list apart&quot; is a good example of an article-centered site, and its print stylesheet (http://www.alistapart.com/css/print.css) is only a handful of declarations — hiding few things, displaying anchors urls, normalizing positoning, etc. I can&#039;t imagine a print stylesheet 30-40% size of a main one (as you mention). It&#039;s more like 1-5%, or even less. Given proper compression and minification, the additional weight of print-related rules becomes even less significant.
Second, providing print stylesheet via Javascript is really terrible for accessibility. Why should people with Javascript disabled, not available or stripped off receive worse treatment? NOSCRIPT-based fallback is also a poor solution (see, for example, this comment on my blog — http://perfectionkills.com/optimizing-html/#comment-56958). In a typical scenario, where print declarations are of reasonable size, I really don&#039;t think it&#039;s worth employing Javascript-based solution.
And speaking of browsers downloading print stylesheets at load time, the default behavior is not that unreasonable. What if a user goes offline after opening a document and then tries to print it (perhaps, reading a blog post first, on screen, and then wanting to finish it while commuting back home from the office — this time in a printed form; something I do pretty often).</description> <content:encoded><![CDATA[<p>&#8220;This is very silly behavior. Especially given that virtually none of your website visitors are going to print any of your web pages, unless you are a website like Google Maps. &#8221;</p><p>It was amusing to read this line off of a printed version of this post, during lunch, few days ago <img
src='http://zoompf.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>I think the &#8220;problem&#8221; with print stylesheets is generally not that severe, and some of the advise given here is somewhat harmful when employed on the public web.</p><p>First of all, it&#8217;s hard to imagine a print stylesheet of a large size. Not in a typical scenario. In my experience, print stylesheets usually consist of a rather small set of rules; rules that mainly cancel out some of the screen formatting. &#8220;A list apart&#8221; is a good example of an article-centered site, and its print stylesheet (<a
href="http://www.alistapart.com/css/print.css" rel="nofollow">http://www.alistapart.com/css/print.css</a>) is only a handful of declarations — hiding few things, displaying anchors urls, normalizing positoning, etc. I can&#8217;t imagine a print stylesheet 30-40% size of a main one (as you mention). It&#8217;s more like 1-5%, or even less. Given proper compression and minification, the additional weight of print-related rules becomes even less significant.</p><p>Second, providing print stylesheet via Javascript is really terrible for accessibility. Why should people with Javascript disabled, not available or stripped off receive worse treatment? NOSCRIPT-based fallback is also a poor solution (see, for example, this comment on my blog — <a
href="http://perfectionkills.com/optimizing-html/#comment-56958" rel="nofollow">http://perfectionkills.com/optimizing-html/#comment-56958</a>). In a typical scenario, where print declarations are of reasonable size, I really don&#8217;t think it&#8217;s worth employing Javascript-based solution.</p><p>And speaking of browsers downloading print stylesheets at load time, the default behavior is not that unreasonable. What if a user goes offline after opening a document and then tries to print it (perhaps, reading a blog post first, on screen, and then wanting to finish it while commuting back home from the office — this time in a printed form; something I do pretty often).</p> ]]></content:encoded> </item> <item><title>By: Billy Hoffman</title><link>http://zoompf.com/blog/2009/12/browser-performance-problem-with-css-print-media-type#comment-22</link> <dc:creator>Billy Hoffman</dc:creator> <pubDate>Mon, 07 Dec 2009 22:02:37 +0000</pubDate> <guid
isPermaLink="false">http://zoompf.com/blog/?p=226#comment-22</guid> <description>Kyle,
Good question. I just ran a test and putting a &lt;LINK&gt; tag at the bottom of your HTML, even if it has a &quot;print&quot; media type, delays the &quot;start render&quot; until all the style sheets has been downloaded. This makes everything much was as nothing gets drawn until everything gets downloaded!
check out the webpagetest results: http://www.webpagetest.org/result/091207_f078bac18b54823e149c6e87aea8c96c/1/details/</description> <content:encoded><![CDATA[<p>Kyle,</p><p>Good question. I just ran a test and putting a<link> tag at the bottom of your HTML, even if it has a &#8220;print&#8221; media type, delays the &#8220;start render&#8221; until all the style sheets has been downloaded. This makes everything much was as nothing gets drawn until everything gets downloaded!</p><p>check out the webpagetest results: <a
href="http://www.webpagetest.org/result/091207_f078bac18b54823e149c6e87aea8c96c/1/details/" rel="nofollow">http://www.webpagetest.org/result/091207_f078bac18b54823e149c6e87aea8c96c/1/details/</a></link> ]]></content:encoded> </item> <item><title>By: Kyle Simpson</title><link>http://zoompf.com/blog/2009/12/browser-performance-problem-with-css-print-media-type#comment-21</link> <dc:creator>Kyle Simpson</dc:creator> <pubDate>Mon, 07 Dec 2009 20:20:02 +0000</pubDate> <guid
isPermaLink="false">http://zoompf.com/blog/?p=226#comment-21</guid> <description>Could you also effectively do about the same thing by just putting your  tag for your print style at the very bottom of the page, that way it gets a much lower loading priority compared to the screen? That is, at least until we get fully internet-aware printers that surf and print automatically... that&#039;ll be interesting. :)</description> <content:encoded><![CDATA[<p>Could you also effectively do about the same thing by just putting your  tag for your print style at the very bottom of the page, that way it gets a much lower loading priority compared to the screen? That is, at least until we get fully internet-aware printers that surf and print automatically&#8230; that&#8217;ll be interesting. <img
src='http://zoompf.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> </item> </channel> </rss>
