<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
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/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>beer planet &#187; JavaScript</title> <atom:link href="http://beerpla.net/tag/javascript/feed/" rel="self" type="application/rss+xml" /><link>http://beerpla.net</link> <description>where things have nothing to do with beer - tutorials, tips, how-tos, thoughts, hacks, and other techy nonsense</description> <lastBuildDate>Thu, 17 May 2012 22:50:53 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <atom:link rel='hub' href='http://beerpla.net/?pushpress=hub'/> <item><title>Follow-up To Loading CSS And JS Conditionally</title><link>http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/</link> <comments>http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/#comments</comments> <pubDate>Fri, 15 Jan 2010 20:07:40 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[Programming]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[action]]></category> <category><![CDATA[admin_print_scripts]]></category> <category><![CDATA[admin_print_styles]]></category> <category><![CDATA[conditional]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[enqueue]]></category> <category><![CDATA[hook]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[js]]></category> <category><![CDATA[load]]></category> <category><![CDATA[ob_flush]]></category> <category><![CDATA[ob_start]]></category> <category><![CDATA[optimization]]></category> <category><![CDATA[output buffer]]></category> <category><![CDATA[Performance]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[script]]></category> <category><![CDATA[style]]></category> <category><![CDATA[time]]></category> <category><![CDATA[wp_enqueue_script]]></category> <category><![CDATA[wp_enqueue_style]]></category> <category><![CDATA[wp_print_scripts]]></category> <category><![CDATA[wp_print_styles]]></category> <guid
isPermaLink="false">http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/</guid> <description><![CDATA[<p>First of all, I&#039;d like to thank everyone who read and gave their 2 cents about the <a
href="http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/">[Wordpress Plugin Development] How To Include CSS and JavaScript Conditionally And Only When Needed By The Posts</a> post. The article was well received and will hopefully spark some optimizations around loading styles and scripts.</p><p>Here are some discussions and mentions around the web:</p><ul><li><a
href="http://weblogtoolscollection.com/archives/2010/01/15/how-to-include-css-and-javascript-conditionally/" rel="nofollow">an article</a> on Weblog Tools Collection</li><li><a
href="http://www.wptavern.com/forum/resources/1213-including-javascript-css-conditionally.html" rel="nofollow">a forum post</a> on WP Tavern</li><li><a
href="http://topsy.com/tb/ping.fm/DIM0S" rel="nofollow">twitter</a> retweets</li></ul><p>Sure, there are drawbacks to this method and it does require some more processing on the backend and it&#039;s not for everyone, which is why we should always strive for an even better solution.</p><p>I stand by my point of view that, for instance, my dedicated ...<div
class=clear></div> <a
href="http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></p>]]></description> <content:encoded><![CDATA[<p>First of all, I&#039;d like to thank everyone who read and gave their 2 cents about the <a
href="http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/">[Wordpress Plugin Development] How To Include CSS and JavaScript Conditionally And Only When Needed By The Posts</a> post. The article was well received and will hopefully spark some optimizations around loading styles and scripts.</p><p>Here are some discussions and mentions around the web:</p><ul><li><a
href="http://weblogtoolscollection.com/archives/2010/01/15/how-to-include-css-and-javascript-conditionally/" rel="nofollow">an article</a> on Weblog Tools Collection</li><li><a
href="http://www.wptavern.com/forum/resources/1213-including-javascript-css-conditionally.html" rel="nofollow">a forum post</a> on WP Tavern</li><li><a
href="http://topsy.com/tb/ping.fm/DIM0S" rel="nofollow">twitter</a> retweets</li></ul><p>Sure, there are drawbacks to this method and it does require some more processing on the backend and it&#039;s not for everyone, which is why we should always strive for an even better solution.</p><p>I stand by my point of view that, for instance, my dedicated gallery shouldn&#039;t load for people who will never even go see my photos.</p><p>I think an ideal solution would be for WP core developers, who had a lot of experience designing WordPress&#039; internals and who know what can work and what can&#039;t, perhaps <a
href="http://www.ma.tt" rel="nofollow">Matt</a> included, to get together and think about a better solution really hard.</p><p>Conditional loading similar to the one discussed here is already possible in the admin area, which creates dynamic hooks by appending page ids to <strong><em>&#039;admin_print_styles&#039;</em></strong> and <strong><em>&#039;admin_print_scripts&#039;</em></strong>. It is, however, still not good enough to be used more generically because those hooks rely on the page you are on, rather than the content of that page.</p><p>Another possibility is using a PHP technique called <strong><em>output buffering</em></strong> (<a
href="http://php.net/manual/en/function.ob-start.php" rel="nofollow"><strong><em>ob_start()</em></strong></a>, <a
href="http://www.php.net/manual/en/function.ob-flush.php" rel="nofollow"><strong><em>ob_flush()</em></strong></a>, etc) that grants second chances to data that had already been echoed. It intercepts all echo and print calls and redirects them into a memory buffer, so instead of printing data to the page right away, you can now modify the header even if it had already been processed. It&#039;s like giving it a second chance.</p><p>Would it work for WordPress? I am not sure but I sure could use your feedback, devs.</p><p><div
class="note"><div
class="notetip"><strong>Update: </strong>Scribu, a WordPress master, <a
href="http://scribu.net/wordpress/optimal-script-loading.html" rel="nofollow">came up with the approach</a> that would at least handle loading JS, as it would put it in the footer, which can be done after the posts have been parsed.</p><p>His approach doesn&#039;t handle CSS which is why I decided to seek another solution but it doesn&#039;t require an extra pass through the posts and it benefits from using the shortcode API instead of stripos() or some hacky regex you&#039;d need to come up with.</p><p>It&#039;s a great compromise for developers who do not want to take the approach I outlined in the article linked at the top of this page.</div></div></p><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=Follow-up+To+Loading+CSS+And+JS+Conditionally&amp;link=http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/&amp;notes=First%20of%20all%2C%20I%27d%20like%20to%20thank%20everyone%20who%20read%20and%20gave%20their%202%20cents%20about%20the%20%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts%20post.%20The%20article%20was%20well%20received%20and%20will%20hopefully%20spark%20some%20optimizations%20around%20loading%20styles%20an&amp;short_link=http://bit.ly/76og1l&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=Follow-up+To+Loading+CSS+And+JS+Conditionally&amp;link=http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/&amp;notes=First%20of%20all%2C%20I%27d%20like%20to%20thank%20everyone%20who%20read%20and%20gave%20their%202%20cents%20about%20the%20%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts%20post.%20The%20article%20was%20well%20received%20and%20will%20hopefully%20spark%20some%20optimizations%20around%20loading%20styles%20an&amp;short_link=http://bit.ly/76og1l&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=Follow-up+To+Loading+CSS+And+JS+Conditionally&amp;link=http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/&amp;notes=First%20of%20all%2C%20I%27d%20like%20to%20thank%20everyone%20who%20read%20and%20gave%20their%202%20cents%20about%20the%20%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts%20post.%20The%20article%20was%20well%20received%20and%20will%20hopefully%20spark%20some%20optimizations%20around%20loading%20styles%20an&amp;short_link=http://bit.ly/76og1l&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=Follow-up+To+Loading+CSS+And+JS+Conditionally&amp;link=http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/&amp;notes=First%20of%20all%2C%20I%27d%20like%20to%20thank%20everyone%20who%20read%20and%20gave%20their%202%20cents%20about%20the%20%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts%20post.%20The%20article%20was%20well%20received%20and%20will%20hopefully%20spark%20some%20optimizations%20around%20loading%20styles%20an&amp;short_link=http://bit.ly/76og1l&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=Follow-up+To+Loading+CSS+And+JS+Conditionally&amp;link=http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/&amp;notes=First%20of%20all%2C%20I%27d%20like%20to%20thank%20everyone%20who%20read%20and%20gave%20their%202%20cents%20about%20the%20%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts%20post.%20The%20article%20was%20well%20received%20and%20will%20hopefully%20spark%20some%20optimizations%20around%20loading%20styles%20an&amp;short_link=http://bit.ly/76og1l&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=Follow-up+To+Loading+CSS+And+JS+Conditionally&amp;link=http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/&amp;notes=First%20of%20all%2C%20I%27d%20like%20to%20thank%20everyone%20who%20read%20and%20gave%20their%202%20cents%20about%20the%20%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts%20post.%20The%20article%20was%20well%20received%20and%20will%20hopefully%20spark%20some%20optimizations%20around%20loading%20styles%20an&amp;short_link=http://bit.ly/76og1l&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=Follow-up+To+Loading+CSS+And+JS+Conditionally&amp;link=http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/&amp;notes=First%20of%20all%2C%20I%27d%20like%20to%20thank%20everyone%20who%20read%20and%20gave%20their%202%20cents%20about%20the%20%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts%20post.%20The%20article%20was%20well%20received%20and%20will%20hopefully%20spark%20some%20optimizations%20around%20loading%20styles%20an&amp;short_link=http://bit.ly/76og1l&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=Follow-up%20To%20Loading%20CSS%20And%20JS%20Conditionally&amp;link=http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/&amp;notes=First%20of%20all%2C%20I%27d%20like%20to%20thank%20everyone%20who%20read%20and%20gave%20their%202%20cents%20about%20the%20%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts%20post.%20The%20article%20was%20well%20received%20and%20will%20hopefully%20spark%20some%20optimizations%20around%20loading%20styles%20an&amp;short_link=http://bit.ly/76og1l&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/" rel="bookmark" title="January 13, 2010">[WordPress Plugin Development] How To Include CSS and JavaScript Conditionally And Only When Needed By The Posts</a></li><li><a
href="http://beerpla.net/2009/02/17/swapping-column-values-in-mysql/" rel="bookmark" title="February 17, 2009">Swapping Column Values in MySQL</a></li><li><a
href="http://beerpla.net/2010/11/06/how-to-dynamically-increase-memory-limits-when-interfacing-with-wordpress-using-xml-rpc-windows-live-writer-etc/" rel="bookmark" title="November 6, 2010">How To Dynamically Increase Memory Limits When Interfacing With WordPress Using XML-RPC (Windows Live Writer, Etc)</a></li><li><a
href="http://beerpla.net/2010/01/31/how-to-remove-inline-hardcoded-recent-comments-sidebar-widget-style-from-your-wordpress-theme/" rel="bookmark" title="January 31, 2010">How To Remove Inline Hardcoded Recent Comments Sidebar Widget Style From Your WordPress Theme</a></li><li><a
href="http://beerpla.net/2012/04/13/how-to-fix-incomplete-wordpress-wxr-exports/" rel="bookmark" title="April 13, 2012">How To Fix Incomplete WordPress (WXR) Exports</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2010%2F01%2F15%2Ffollow-up-to-loading-css-and-js-conditionally%2F&amp;title=Follow-up%20To%20Loading%20CSS%20And%20JS%20Conditionally" id="wpa2a_2"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>20 Inspirational And Original Comment Form Designs For Your Blog</title><link>http://beerpla.net/2010/01/15/20-inspirational-and-original-comment-form-designs-for-your-blog/</link> <comments>http://beerpla.net/2010/01/15/20-inspirational-and-original-comment-form-designs-for-your-blog/#comments</comments> <pubDate>Fri, 15 Jan 2010 17:00:00 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[CSS]]></category> <category><![CDATA[Inspiration]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[Web Design]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[blog]]></category> <category><![CDATA[button]]></category> <category><![CDATA[comment]]></category> <category><![CDATA[design]]></category> <category><![CDATA[form]]></category> <category><![CDATA[grungy]]></category> <category><![CDATA[js]]></category> <category><![CDATA[original]]></category> <category><![CDATA[style]]></category> <category><![CDATA[stylesheet]]></category> <category><![CDATA[submit]]></category> <category><![CDATA[webdev]]></category> <guid
isPermaLink="false">http://beerpla.net/?p=1375</guid> <description><![CDATA[<h2><img
style="margin: 0px 10px 10px 0px; display: inline" title="thumbnail" alt="thumbnail" align="left" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_34.png" width="150" height="150" /> Introduction</h2><p>If you follow web design at all, you probably see 5 billion top NN posts on a daily basis mentioning site and blog designs, fonts, icons, etc.</p><p>However, nobody seems to be paying attention to these little but important guys: comment forms.</p><p>If you have an appealing comment box, you are more likely to receive comments (this is based on days of scientific research that I imagined I did in my head) and your content is more likely to be re-shared, voted up, and saved.</p><p>I really do feel that way when I visit blogs, especially when an otherwise aesthetically pleasing site has a plain vanilla comment box.</p><h2>Let&#039;s Go</h2><p>So here we go. I have looked through hundreds ...<div
class=clear></div> <a
href="http://beerpla.net/2010/01/15/20-inspirational-and-original-comment-form-designs-for-your-blog/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></p>]]></description> <content:encoded><![CDATA[<h2><img
style="margin: 0px 10px 10px 0px; display: inline" title="thumbnail" alt="thumbnail" align="left" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_34.png" width="150" height="150" /> Introduction</h2><p>If you follow web design at all, you probably see 5 billion top NN posts on a daily basis mentioning site and blog designs, fonts, icons, etc.</p><p>However, nobody seems to be paying attention to these little but important guys: comment forms.</p><p>If you have an appealing comment box, you are more likely to receive comments (this is based on days of scientific research that I imagined I did in my head) and your content is more likely to be re-shared, voted up, and saved.</p><p>I really do feel that way when I visit blogs, especially when an otherwise aesthetically pleasing site has a plain vanilla comment box.</p><h2>Let&#039;s Go</h2><p>So here we go. I have looked through hundreds of sites to make this collection, go ahead and let me know if you like it (yeah, I know, my comment box is not as spiffy as theirs).</p><p>I&#039;ve also included my notes with the parts that I liked.</p><h3>1. <a
href="http://www.blog.spoongraphics.co.uk">blog.spoongraphics.co.uk</a>&#160;</h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image.png" class="lightview" rel="gallery['1375']" title="http://www.blog.spoongraphics.co.uk"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.blog.spoongraphics.co.uk" alt="http://www.blog.spoongraphics.co.uk" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb.png" width="650" height="271" /></a>&#160;</p><ul><li>interesting submit button</li><li>fun background</li><li>great font</li><li>grungy</li><li>border glow</li><li>normal:</li></ul><p><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="normal" alt="normal" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_3.png" width="304" height="56" /></p><ul><li>focused:</li></ul><p><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="focused" alt="focused" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_4.png" width="302" height="58" /></p><p>&#160;</p><h3>2. <a
title="http://www.springydevelopment.co.uk" href="http://www.springydevelopment.co.uk">springydevelopment.co.uk</a></h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_5.png" class="lightview" rel="gallery['1375']" title="http://www.springydevelopment.co.uk"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.springydevelopment.co.uk" alt="http://www.springydevelopment.co.uk" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_3.png" width="656" height="265" /></a></p><ul><li>2 column</li><li>wide submit button</li></ul><p>&#160;</p><h3>3. <a
title="http://css-tricks.com" href="http://css-tricks.com">css-tricks.com</a></h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_6.png" class="lightview" rel="gallery['1375']" title="http://css-tricks.com"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://css-tricks.com" alt="http://css-tricks.com" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_4.png" width="589" height="313" /></a></p><ul><li>Chris Coyier doesn&#039;t mess around with crappy designs &#8211; his website is superb in general</li><li>normal<a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_7.png" class="lightview" rel="gallery['1375']">:</a></li></ul><p><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="normal" alt="normal" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_5.png" width="185" height="39" /></p><ul><li>focused:</li></ul><p><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="focused" alt="focused" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_8.png" width="185" height="41" /></p><ul><li>internal disappearing labels</li><li>dimming labels</li><li>interesting submit button</li><li>custom images</li></ul><p>&#160;</p><h3>4. <a
title="http://net.tutsplus.com" href="http://net.tutsplus.com">net.tutsplus.com</a></h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_9.png" class="lightview" rel="gallery['1375']" title="image"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_6.png" width="633" height="399" /></a></p><ul><li>tongue:</li></ul><p><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="tongue" alt="tongue" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_10.png" width="153" height="147" /></p><ul><li>internal disappearing labels</li><li>appealing default avatar</li></ul><p>&#160;</p><h3>5. <a
title="http://www.smashingmagazine.com" href="http://www.smashingmagazine.com">smashingmagazine.com</a></h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_11.png" class="lightview" rel="gallery['1375']" title="http://www.smashingmagazine.com"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.smashingmagazine.com" alt="http://www.smashingmagazine.com" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_7.png" width="650" height="536" /></a></p><ul><li>simplistic</li><li>appealing submit button</li><li>absence of author website &#8211; less spam</li></ul><p>&#160;</p><h3>6. <a
title="http://www.branded07.com" href="http://www.branded07.com">branded07.com</a></h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_12.png" class="lightview" rel="gallery['1375']" title="http://www.branded07.com"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.branded07.com" alt="http://www.branded07.com" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_8.png" width="639" height="585" /></a></p><ul><li>fading</li><li>interesting background</li></ul><p>&#160;</p><h3>7. <a
title="http://www.depcore.com" href="http://www.depcore.com">depcore.com</a></h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_13.png" class="lightview" rel="gallery['1375']" title="http://www.depcore.com"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.depcore.com" alt="http://www.depcore.com" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_9.png" width="578" height="349" /></a></p><ul><li>simplistic</li><li>unconventional &#8211; looks like a pad of paper or a letter</li><li>contains an anti-spam measure</li></ul><p>&#160;</p><h3>8. <a
title="http://www.marcofolio.net" href="http://www.marcofolio.net">marcofolio.net</a></h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_14.png" class="lightview" rel="gallery['1375']" title="http://www.marcofolio.net"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.marcofolio.net" alt="http://www.marcofolio.net" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_10.png" width="560" height="518" /></a></p><ul><li>notify/don&#039;t notify option (for the first time the design is cohesive &#8211; not some random checkbox under the submit button)</li><li>lots of formatting buttons</li><li>smilies</li></ul><p>&#160;</p><h3>9. <a
title="http://www.jankoatwarpspeed.com" href="http://www.jankoatwarpspeed.com">jankoatwarpspeed.com</a></h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_15.png" class="lightview" rel="gallery['1375']" title="http://www.jankoatwarpspeed.com"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.jankoatwarpspeed.com" alt="http://www.jankoatwarpspeed.com" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_11.png" width="625" height="566" /></a></p><ul><li>handy and appealing formatting buttons</li><li>flag next to the country &#8211; it then shows up next to each commenter, kind of cool:</li></ul><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_16.png" class="lightview" rel="gallery['1375']" title="http://www.jankoatwarpspeed.com flags"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.jankoatwarpspeed.com flags" alt="http://www.jankoatwarpspeed.com flags" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_12.png" width="238" height="180" /></a>&#160;</p><h3>10. <a
title="http://www.dezinerfolio.com" href="http://www.dezinerfolio.com">dezinerfolio.com</a></h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_17.png" class="lightview" rel="gallery['1375']" title="http://www.dezinerfolio.com"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.dezinerfolio.com" alt="http://www.dezinerfolio.com" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_13.png" width="650" height="543" /></a></p><ul><li>highlight the field with focus &#8211; concentrate attention on one spot</li><li>large padding</li><li>by the way, they have an amazing header. I couldn&#039;t resist:</li></ul><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_18.png" class="lightview" rel="gallery['1375']" title="http://www.dezinerfolio.com header"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.dezinerfolio.com header" alt="http://www.dezinerfolio.com header" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_14.png" width="650" height="267" /></a></p><p>&#160;</p><h3>11. <a
title="http://www.sohtanaka.com" href="http://www.sohtanaka.com">sohtanaka.com</a></h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_19.png" class="lightview" rel="gallery['1375']" title="http://www.sohtanaka.com"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.sohtanaka.com" alt="http://www.sohtanaka.com" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_15.png" width="650" height="431" /></a></p><ul><li>I love it</li><li>custom submit button</li><li>hovering quote</li><li>very polished look</li></ul><p>&#160;</p><h3>12. <a
title="http://www.productivedreams.com" href="http://www.productivedreams.com">productivedreams.com</a></h3><h3><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_20.png" class="lightview" rel="gallery['1375']" title="http://www.productivedreams.com"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.productivedreams.com" alt="http://www.productivedreams.com" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_16.png" width="596" height="264" /></a></h3><ul><li>the comment box actually sits *above* the comments &#8211; a radical, yet interesting approach</li><li>custom icons</li><li>really nice custom highlight on hover effect:</li></ul><p><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.productivedreams.com hover" alt="http://www.productivedreams.com hover" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_21.png" width="233" height="117" /></p><ul><li>usability and UX at their best</li></ul><p>&#160;</p><h3>13. <a
title="http://www.kevadamson.com" href="http://www.kevadamson.com">kevadamson.com</a></h3><h3><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_22.png" class="lightview" rel="gallery['1375']" title="http://www.kevadamson.com"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.kevadamson.com" alt="http://www.kevadamson.com" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_17.png" width="454" height="639" /></a></h3><ul><li>grungy, sloppy &#8211; looks great!</li></ul><p>&#160;</p><h3>14. <a
title="http://line25.com" href="http://line25.com">line25.com</a></h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_23.png" class="lightview" rel="gallery['1375']" title="http://line25.com"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://line25.com" alt="http://line25.com" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_18.png" width="504" height="253" /></a></p><ul><li>clean</li><li>side by side</li><li>symmetrical, exact</li><li>I love it</li></ul><p>&#160;</p><h3>15. <a
title="http://www.markforrester.co.za" href="http://www.markforrester.co.za">markforrester.co.za</a></h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_24.png" class="lightview" rel="gallery['1375']" title="http://www.markforrester.co.za"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.markforrester.co.za" alt="http://www.markforrester.co.za" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_19.png" width="650" height="456" /></a></p><ul><li>colorful, crayon-like (though it looks better on the site itself &#8211; you need to see it in its natural habitat)</li><li>internal disappearing labels</li></ul><p>&#160;</p><h3>16. <a
href="http://www.jrvelasco.com">jrvelasco.com</a></h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_25.png" class="lightview" rel="gallery['1375']" title="http://www.jrvelasco.com"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.jrvelasco.com" alt="http://www.jrvelasco.com" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_20.png" width="507" height="652" /></a></p><ul><li>simple, and yet sophisticated</li></ul><p>&#160;</p><h3>17. <a
title="http://gizmodo.com" href="http://gizmodo.com">gizmodo.com</a></h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_26.png" class="lightview" rel="gallery['1375']" title="http://gizmodo.com 1"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://gizmodo.com 1" alt="http://gizmodo.com 1" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_21.png" width="515" height="80" /></a></p><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_27.png" class="lightview" rel="gallery['1375']" title="http://gizmodo.com 2"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://gizmodo.com 2" alt="http://gizmodo.com 2" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_22.png" width="515" height="171" /></a></p><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_28.png" class="lightview" rel="gallery['1375']" title="http://gizmodo.com 3"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://gizmodo.com 3" alt="http://gizmodo.com 3" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_23.png" width="515" height="338" /></a></p><ul><li>very simple from the UX perspective:<ul><li>single line box, without the need to login first</li><li>expands on focus</li><li>no need to login even then, unless you want to &#8211; just enter your email</li></ul></li></ul><p>&#160;</p><h3>18. <a
title="http://www.instantshift.com" href="http://www.instantshift.com">instantshift.com</a></h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_29.png" class="lightview" rel="gallery['1375']" title="http://www.instantshift.com"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.instantshift.com" alt="http://www.instantshift.com" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_24.png" width="650" height="589" /></a></p><ul><li>this is one of my favorites</li><li>I love, love, love the way the comments look, especially the way the author ones stand out:</li></ul><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_30.png" class="lightview" rel="gallery['1375']" title="http://www.instantshift.com comments"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.instantshift.com comments" alt="http://www.instantshift.com comments" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_25.png" width="627" height="436" /></a></p><p>&#160;</p><h3>19. <a
title="http://www.koodoz.com.au" href="http://www.koodoz.com.au">koodoz.com.au</a></h3><h3><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_31.png" class="lightview" rel="gallery['1375']" title="http://www.koodoz.com.au"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.koodoz.com.au" alt="http://www.koodoz.com.au" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_26.png" width="475" height="446" /></a></h3><ul><li>internal disappearing labels</li><li>the design itself, while seemingly not too special, mashes with comment list very well. Check it out &#8211; I think the curvy lines are very creative:</li></ul><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_32.png" class="lightview" rel="gallery['1375']" title="http://www.koodoz.com.au comments"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://www.koodoz.com.au comments" alt="http://www.koodoz.com.au comments" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_27.png" width="584" height="327" /></a></p><p>&#160;</p><h3>20. <a
href="http://elliotjaystocks.com">elliotjaystocks.com</a></h3><p><a
href="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_33.png" class="lightview" rel="gallery['1375']" title="http://elliotjaystocks.com"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="http://elliotjaystocks.com" alt="http://elliotjaystocks.com" src="http://beerpla.net/wp-content/uploads/64b6eeb98e37_14BE3/image_thumb_28.png" width="650" height="509" /></a></p><ul><li>click the image &#8211; it&#039;s bigger than it looks</li><li>if you can&#039;t tell (), the elements are MASSIVE, which makes this comment box pretty unique</li></ul><p>&#160;</p><h2>Conclusion</h2><p>If you liked this post, you might also enjoy</p><ul><li>BlogDesignBlog with <a
href="http://www.blogdesignblog.com/blog-design/37-ways-to-design-the-comments-form" rel="nofollow">37 more comment form designs</a> (though they&#039;re not as exciting).</li><li>1stwebdesigner with <a
href="http://www.1stwebdesigner.com/inspiration/77-inspiring-blog-comment-form-designs-good-examples/" rel="nofollow">77 comment form designs</a>.</li><li>Queness with <a
href="http://www.queness.com/post/1581/20-absolutely-stylish-web-form-design-showcase" rel="nofollow">20 stylish web form designs</a>.</li></ul><p>So, what did you think? The comment box you&#039;re looking for is at the bottom of the page.</p><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=20+Inspirational+And+Original+Comment+Form+Designs+For+Your+Blog&amp;link=http://beerpla.net/2010/01/15/20-inspirational-and-original-comment-form-designs-for-your-blog/&amp;notes=%20Introduction%20%20If%20you%20follow%20web%20design%20at%20all%2C%20you%20probably%20see%205%20billion%20top%20NN%20posts%20on%20a%20daily%20basis%20mentioning%20site%20and%20blog%20designs%2C%20fonts%2C%20icons%2C%20etc.%20%20However%2C%20nobody%20seems%20to%20be%20paying%20attention%20to%20these%20little%20but%20important%20guys%3A%20comment%20forms.%20%20If%20you%20have%20an%20appealing%20comment%20box%2C%20you%20ar&amp;short_link=http://bit.ly/6L55UJ&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=20+Inspirational+And+Original+Comment+Form+Designs+For+Your+Blog&amp;link=http://beerpla.net/2010/01/15/20-inspirational-and-original-comment-form-designs-for-your-blog/&amp;notes=%20Introduction%20%20If%20you%20follow%20web%20design%20at%20all%2C%20you%20probably%20see%205%20billion%20top%20NN%20posts%20on%20a%20daily%20basis%20mentioning%20site%20and%20blog%20designs%2C%20fonts%2C%20icons%2C%20etc.%20%20However%2C%20nobody%20seems%20to%20be%20paying%20attention%20to%20these%20little%20but%20important%20guys%3A%20comment%20forms.%20%20If%20you%20have%20an%20appealing%20comment%20box%2C%20you%20ar&amp;short_link=http://bit.ly/6L55UJ&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=20+Inspirational+And+Original+Comment+Form+Designs+For+Your+Blog&amp;link=http://beerpla.net/2010/01/15/20-inspirational-and-original-comment-form-designs-for-your-blog/&amp;notes=%20Introduction%20%20If%20you%20follow%20web%20design%20at%20all%2C%20you%20probably%20see%205%20billion%20top%20NN%20posts%20on%20a%20daily%20basis%20mentioning%20site%20and%20blog%20designs%2C%20fonts%2C%20icons%2C%20etc.%20%20However%2C%20nobody%20seems%20to%20be%20paying%20attention%20to%20these%20little%20but%20important%20guys%3A%20comment%20forms.%20%20If%20you%20have%20an%20appealing%20comment%20box%2C%20you%20ar&amp;short_link=http://bit.ly/6L55UJ&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=20+Inspirational+And+Original+Comment+Form+Designs+For+Your+Blog&amp;link=http://beerpla.net/2010/01/15/20-inspirational-and-original-comment-form-designs-for-your-blog/&amp;notes=%20Introduction%20%20If%20you%20follow%20web%20design%20at%20all%2C%20you%20probably%20see%205%20billion%20top%20NN%20posts%20on%20a%20daily%20basis%20mentioning%20site%20and%20blog%20designs%2C%20fonts%2C%20icons%2C%20etc.%20%20However%2C%20nobody%20seems%20to%20be%20paying%20attention%20to%20these%20little%20but%20important%20guys%3A%20comment%20forms.%20%20If%20you%20have%20an%20appealing%20comment%20box%2C%20you%20ar&amp;short_link=http://bit.ly/6L55UJ&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=20+Inspirational+And+Original+Comment+Form+Designs+For+Your+Blog&amp;link=http://beerpla.net/2010/01/15/20-inspirational-and-original-comment-form-designs-for-your-blog/&amp;notes=%20Introduction%20%20If%20you%20follow%20web%20design%20at%20all%2C%20you%20probably%20see%205%20billion%20top%20NN%20posts%20on%20a%20daily%20basis%20mentioning%20site%20and%20blog%20designs%2C%20fonts%2C%20icons%2C%20etc.%20%20However%2C%20nobody%20seems%20to%20be%20paying%20attention%20to%20these%20little%20but%20important%20guys%3A%20comment%20forms.%20%20If%20you%20have%20an%20appealing%20comment%20box%2C%20you%20ar&amp;short_link=http://bit.ly/6L55UJ&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=20+Inspirational+And+Original+Comment+Form+Designs+For+Your+Blog&amp;link=http://beerpla.net/2010/01/15/20-inspirational-and-original-comment-form-designs-for-your-blog/&amp;notes=%20Introduction%20%20If%20you%20follow%20web%20design%20at%20all%2C%20you%20probably%20see%205%20billion%20top%20NN%20posts%20on%20a%20daily%20basis%20mentioning%20site%20and%20blog%20designs%2C%20fonts%2C%20icons%2C%20etc.%20%20However%2C%20nobody%20seems%20to%20be%20paying%20attention%20to%20these%20little%20but%20important%20guys%3A%20comment%20forms.%20%20If%20you%20have%20an%20appealing%20comment%20box%2C%20you%20ar&amp;short_link=http://bit.ly/6L55UJ&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=20+Inspirational+And+Original+Comment+Form+Designs+For+Your+Blog&amp;link=http://beerpla.net/2010/01/15/20-inspirational-and-original-comment-form-designs-for-your-blog/&amp;notes=%20Introduction%20%20If%20you%20follow%20web%20design%20at%20all%2C%20you%20probably%20see%205%20billion%20top%20NN%20posts%20on%20a%20daily%20basis%20mentioning%20site%20and%20blog%20designs%2C%20fonts%2C%20icons%2C%20etc.%20%20However%2C%20nobody%20seems%20to%20be%20paying%20attention%20to%20these%20little%20but%20important%20guys%3A%20comment%20forms.%20%20If%20you%20have%20an%20appealing%20comment%20box%2C%20you%20ar&amp;short_link=http://bit.ly/6L55UJ&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=20%20Inspirational%20And%20Original%20Comment%20Form%20Designs%20For%20Your%20Blog&amp;link=http://beerpla.net/2010/01/15/20-inspirational-and-original-comment-form-designs-for-your-blog/&amp;notes=%20Introduction%20%20If%20you%20follow%20web%20design%20at%20all%2C%20you%20probably%20see%205%20billion%20top%20NN%20posts%20on%20a%20daily%20basis%20mentioning%20site%20and%20blog%20designs%2C%20fonts%2C%20icons%2C%20etc.%20%20However%2C%20nobody%20seems%20to%20be%20paying%20attention%20to%20these%20little%20but%20important%20guys%3A%20comment%20forms.%20%20If%20you%20have%20an%20appealing%20comment%20box%2C%20you%20ar&amp;short_link=http://bit.ly/6L55UJ&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2008/09/03/thoughts-on-google-chrome/" rel="bookmark" title="September 3, 2008">Thoughts on Google Chrome</a></li><li><a
href="http://beerpla.net/2009/12/20/enable-a-twitter-retweet-rt-button-that-lets-you-add-comments-before-retweeting/" rel="bookmark" title="December 20, 2009">Enable A Twitter Retweet (RT) Button That Lets You Add Comments Before Retweeting</a></li><li><a
href="http://beerpla.net/2010/02/03/how-not-to-implement-a-web-application-that-handles-external-authentication-using-betwittered-com-as-an-example/" rel="bookmark" title="February 3, 2010">How *Not* To Implement A Web Application That Handles External Authentication, Using BeTwittered.com As An Example</a></li><li><a
href="http://beerpla.net/2009/02/12/how-to-fight-clickjacking-using-the-recent-twitter-hijacking-as-an-example/" rel="bookmark" title="February 12, 2009">How To Fight Clickjacking (Using The Recent Twitter Hijacking As An Example)</a></li><li><a
href="http://beerpla.net/2011/06/13/goodbye-outlook-i-dont-need-you-anymore-gmail-now-lets-you-paste-images-directly-from-clipboard/" rel="bookmark" title="June 13, 2011">[Updated x3] Goodbye Outlook, I Don&#039;t Need You Anymore &#8211; Gmail Now Lets You Paste Images Directly From Clipboard</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2010%2F01%2F15%2F20-inspirational-and-original-comment-form-designs-for-your-blog%2F&amp;title=20%20Inspirational%20And%20Original%20Comment%20Form%20Designs%20For%20Your%20Blog" id="wpa2a_4"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2010/01/15/20-inspirational-and-original-comment-form-designs-for-your-blog/feed/</wfw:commentRss> <slash:comments>9</slash:comments> </item> <item><title>[WordPress Plugin Development] How To Include CSS and JavaScript Conditionally And Only When Needed By The Posts</title><link>http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/</link> <comments>http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/#comments</comments> <pubDate>Wed, 13 Jan 2010 17:15:00 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[Tips]]></category> <category><![CDATA[Tutorials]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[action]]></category> <category><![CDATA[admin_print_scripts]]></category> <category><![CDATA[admin_print_styles]]></category> <category><![CDATA[conditional]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[enqueue]]></category> <category><![CDATA[hook]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[js]]></category> <category><![CDATA[load]]></category> <category><![CDATA[optimization]]></category> <category><![CDATA[Performance]]></category> <category><![CDATA[script]]></category> <category><![CDATA[style]]></category> <category><![CDATA[time]]></category> <category><![CDATA[wp_enqueue_script]]></category> <category><![CDATA[wp_enqueue_style]]></category> <category><![CDATA[wp_print_scripts]]></category> <category><![CDATA[wp_print_styles]]></category> <guid
isPermaLink="false">http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/</guid> <description><![CDATA[<h2>Introduction</h2><p><img
style="margin: 0px 10px 10px 0px; display: inline" title="wordpress logo" alt="wordpress logo" align="left" src="http://beerpla.net/wp-content/uploads/WordpressPluginWritersTakeNoteHowToInclu_863C/image_3.png" width="150" height="150" /> In this tutorial, I am going to introduce a WordPress technique that I believe was unpublished until I <a
href="http://wordpress.org/support/topic/350167" rel="nofollow">raised the question</a> a few days ago on the WordPress forums.</p><p>In short, the problem I was trying to solve was <strong><em>plugins unnecessarily loading their JavaScript and CSS on *every* page of the blog, even when doing so would achieve absolutely nothing and the plugin wouldn&#039;t do any work</em></strong>.</p><p><div
class="note"><div
class="notetip"><strong>Update #1:</strong> I have posted a <a
href="http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/">follow-up</a> in response to some comments received around the web.</div></div></p><p><div
class="note"><div
class="notetip"><strong>Update #2:</strong> There is a solution that can be considered a compromise as it works well for loading JavaScript but doesn&#039;t handle CSS.</div></div></p><p>I briefly mentioned this approach here but but Scribu decided to expand ...<div
class=clear></div> <a
href="http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></p>]]></description> <content:encoded><![CDATA[<h2>Introduction</h2><p><img
style="margin: 0px 10px 10px 0px; display: inline" title="wordpress logo" alt="wordpress logo" align="left" src="http://beerpla.net/wp-content/uploads/WordpressPluginWritersTakeNoteHowToInclu_863C/image_3.png" width="150" height="150" /> In this tutorial, I am going to introduce a WordPress technique that I believe was unpublished until I <a
href="http://wordpress.org/support/topic/350167" rel="nofollow">raised the question</a> a few days ago on the WordPress forums.</p><p>In short, the problem I was trying to solve was <strong><em>plugins unnecessarily loading their JavaScript and CSS on *every* page of the blog, even when doing so would achieve absolutely nothing and the plugin wouldn&#039;t do any work</em></strong>.</p><p><div
class="note"><div
class="notetip"><strong>Update #1:</strong> I have posted a <a
href="http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/">follow-up</a> in response to some comments received around the web.</div></div></p><p><div
class="note"><div
class="notetip"><strong>Update #2:</strong> There is a solution that can be considered a compromise as it works well for loading JavaScript but doesn&#039;t handle CSS.</p><p>I briefly mentioned this approach here but but Scribu decided to expand on it by providing a nice Jedi-themed tutorial. It is available <a
href="http://scribu.net/wordpress/optimal-script-loading.html" rel="nofollow">here</a>.</div></div></p><p>Let me explain using this example:</p><ul><li>a code formatter plugin only does something useful when it sees a [code] shortcode in any post on the page.</li><li>most of your posts do not contain the [code] shortcode as you don't include code snippets that often or you only started using this particular plugin recently.</li><li>the plugin, however, loads the CSS and JS (which are most likely <a
href="http://qbnz.com/highlighter/" rel="nofollow">GeSHi</a> and take up loads of space) on every page.</li><li>these CSS and JS do absolutely nothing on most page loads.</li><li>bandwidth is wasted, extra DNS and HTTP requests are processed, the browser is slowed down, and for what? For no good reason, other than the plugin author didn't know how to achieve this conditional loading.</li></ul><p>If you think about it, there are many plugins that only do something once in a blue moon. Table of contents, text manipulators, galleries, sliders, etc, etc. If only they loaded their frontend code strictly when necessary, most page loads would suddenly become much lighter.</p><p>So what can we do to solve this? Let's look at a few techniques.</p><h2>Loading CSS And JS In Place?</h2><p>Here's one, albeit pretty bad, solution - only print the CSS and JS includes if and when you determine somewhere in the middle of loading the posts that the scripts and styles are indeed needed, then set a flag to avoid printing them again. In our example, that would be when the plugin detects the [code] shortcode.</p><p>This, however, is a mediocre solution because, while it's not a bad idea to load Javascript in the footer, <a
href="http://developer.yahoo.com/performance/rules.html" rel="nofollow">CSS should be loaded in the header</a>, otherwise the page might look unformatted until the CSS is reached.</p><p>Additionally, it's not the cleanest and most robust solution because you shouldn't be writing &lt;script&gt; and &lt;style&gt; tags manually but rather using <a
href="http://codex.wordpress.org/Function_Reference/wp_enqueue_style" rel="nofollow">wp_enqueue_style()</a> and <a
href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script" rel="nofollow">wp_enqueue_script()</a> functions.</p><h2>What's This About wp_enqueue_FOO?</h2><p>Now, you might say: &quot;What's this about <strong><em>wp_enqueue_style()</em></strong>, <strong><em>wp_enqueue_script()</em></strong>, and then hooking into <strong><em>'wp_print_scripts'</em></strong>, <strong><em>'wp_print_styles'</em></strong>, <strong><em>'admin_print_scripts'</em></strong>, and <strong><em>'admin_print_styles'</em></strong> hooks&quot;? You know about these, right? Right??</p><p>Allow me to explain this, in my opinion, greatest and most underused WordPress paradigm in a short refresher:</p><p><div
class="note"><div
class="noteclassic">WordPress has a great system of queuing up the scripts and styles your script will need to use and printing them all in one go, rather than hooking into wp_head and printing &lt;style&gt; and &lt;script&gt; tags manually.</p><p>This queuing system achieves 2 main goals:</p><ul><li>the <strong><em>same scripts are not loaded multiple times</em></strong>, such as <a
href="http://jquery.com/" rel="nofollow">jQuery</a>, <a
href="http://script.aculo.us/" rel="nofollow">scriptaculous</a>, or any other custom script or style your plugins may share between each other or even other plugins.</li><li>it introduces support for establishing <strong><em>dependencies</em></strong>. You can specify that your script or style depends on another script or style, and WordPress will take care of loading them in the right order. Guaranteed.</li><li>oh what the hell, here's a 3rd one: <strong><em>elegance</em></strong>.</li></ul><p>Here is the way this usually works:</p><ul><li>in the beginning of your plugin you attach to <strong><em>wp_print_scripts</em></strong> and/or <strong><em>wp_print_styles</em></strong> hooks. For example:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
</pre></td><td
class="code"><pre>add_action( 'wp_print_scripts', 'enqueue_my_scripts' );
add_action( 'wp_print_styles', 'enqueue_my_styles' );</pre></td></tr></table></div><p>What this will do is call the functions in the 2nd parameter when it's time to execute any functions associated with the hooks in the 1st parameter. It is the main principle behind the WordPress plugin architecture.</li><li>looking at the script example, in the <strong><em>enqueue_my_scripts()</em></strong> function, you can do something like:<div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
</pre></td><td
class="code"><pre>wp_enqueue_script( 'my_awesome_script', '/script.js', array( 'jquery' ));</pre></td></tr></table></div><p>which would queue up your script to be printed later but only after jQuery.</p><p>If you or some other plugin calls <strong><em>wp_enqueue_script()</em></strong> with the same first parameter (unique handle), it will just be ignored, rather than printed to the page twice.</li><li>styles are exactly the same, except you use <strong><em>wp_enqueue_style()</em></strong></li></ul><p>There is a variation of this functionality for the admin styles and scripts - all you have to do is change the hooks to <strong><em>admin_print_styles</em></strong> and <strong><em>admin_print_scripts</em></strong>. Ozh made a nice post on this topic <a
href="http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/" rel="nofollow">here</a> - check it out.</p><p></div></div></p><h2>Enqueuing Alone Is Not Enough</h2><p>Enqueuing is great for loading your JS and CSS but using it alone doesn't achieve the conditional behavior that we are looking for here.</p><p>This is a classic case of Chicken or the Egg, because WordPress makes only one pass through all of the content.</p><p>You see, since the header needs to be printed before the content, <strong><em>wp_print_scripts</em></strong> and <strong><em>wp_print_styles</em></strong> hooks are triggered before you even get to the posts. If you enqueue a script or style from within the 'the_content' hook, for example, the queued up scripts and styles will never get printed. It's too late to print them then anyway, as you're already in the middle of printing the posts.</p><h2>The Solution</h2><p>What we need to do is take a step back, before even printing the header, and then peek ahead.</p><p>Sure, this adds an extra pass over some data, but since no filters are applied during this process and if you avoid regular expressions (using stripos(), for example), this extra pass should be quite negligible.</p><p><div
class="note"><div
class="notewarning">A word of warning though: I'd rather see false positives (enqueuing when it's not needed) than false negatives (miss enqueuing when it's needed), so please do your matching wisely and test well.</div></div></p><p>The upside, however, can be potentially very substantial.</p><p>Credit goes to <a
href="http://twitter.com/white_shadow" rel="nofollow">@white_shadow</a> for the idea.</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td
class="code"><pre>add_filter('the_posts', 'conditionally_add_scripts_and_styles'); // the_posts gets triggered before wp_head
function conditionally_add_scripts_and_styles($posts){
	if (empty($posts)) return $posts;
&nbsp;
	$shortcode_found = false; // use this flag to see if styles and scripts need to be enqueued
	foreach ($posts as $post) {
		if (stripos($post-&gt;post_content, '[code]') !== false) {
			$shortcode_found = true; // bingo!
			break;
		}
	}
&nbsp;
	if ($shortcode_found) {
		// enqueue here
		wp_enqueue_style('my-style', '/style.css');
		wp_enqueue_script('my-script', '/script.js');
	}
&nbsp;
	return $posts;
}</pre></td></tr></table></div><p>This simple function fires before the header gets printed, as it's attached to the 'the_posts' hook. However, this time it has full access to the posts' content.</p><p>I have tested this method and it works really well - if you have heavy scripts in your plugin, please do us, users, a favor and incorporate this logic into it.</p><h2>Conclusion</h2><p>In this tutorial, you have seen a method of loading scripts and styles for you plugin conditionally. This technique allows for less bloated pages and faster page loads.</p><p>Plugin developers, what is your take on this solution? Do you use another method? Please share in the comments.</p><div
class='post_blob_1'>Our <a
href="http://www.test-king.com/exams/HP0-D07.htm">HP0-D07</a> study guides will help you to pass your <a
href="http://www.test-king.com/exams/642-436.htm">642-436</a> and <a
href="http://www.test-king.com/exams/640-816.htm">640-816</a> exam on first attempt guaranteed.</div><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=%5BWordpress+Plugin+Development%5D+How+To+Include+CSS+and+JavaScript+Conditionally+And+Only+When+Needed+By+The+Posts&amp;link=http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/&amp;notes=Introduction%0D%0A%20In%20this%20tutorial%2C%20I%20am%20going%20to%20introduce%20a%20Wordpress%20technique%20that%20I%20believe%20was%20unpublished%20until%20I%20raised%20the%20question%20a%20few%20days%20ago%20on%20the%20Wordpress%20forums.%0D%0AIn%20short%2C%20the%20problem%20I%20was%20trying%20to%20solve%20was%20plugins%20unnecessarily%20loading%20their%20JavaScript%20and%20CSS%20on%20%2Aevery%2A%20page%20of&amp;short_link=http://bit.ly/aH8tGB&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=%5BWordpress+Plugin+Development%5D+How+To+Include+CSS+and+JavaScript+Conditionally+And+Only+When+Needed+By+The+Posts&amp;link=http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/&amp;notes=Introduction%0D%0A%20In%20this%20tutorial%2C%20I%20am%20going%20to%20introduce%20a%20Wordpress%20technique%20that%20I%20believe%20was%20unpublished%20until%20I%20raised%20the%20question%20a%20few%20days%20ago%20on%20the%20Wordpress%20forums.%0D%0AIn%20short%2C%20the%20problem%20I%20was%20trying%20to%20solve%20was%20plugins%20unnecessarily%20loading%20their%20JavaScript%20and%20CSS%20on%20%2Aevery%2A%20page%20of&amp;short_link=http://bit.ly/aH8tGB&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=%5BWordpress+Plugin+Development%5D+How+To+Include+CSS+and+JavaScript+Conditionally+And+Only+When+Needed+By+The+Posts&amp;link=http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/&amp;notes=Introduction%0D%0A%20In%20this%20tutorial%2C%20I%20am%20going%20to%20introduce%20a%20Wordpress%20technique%20that%20I%20believe%20was%20unpublished%20until%20I%20raised%20the%20question%20a%20few%20days%20ago%20on%20the%20Wordpress%20forums.%0D%0AIn%20short%2C%20the%20problem%20I%20was%20trying%20to%20solve%20was%20plugins%20unnecessarily%20loading%20their%20JavaScript%20and%20CSS%20on%20%2Aevery%2A%20page%20of&amp;short_link=http://bit.ly/aH8tGB&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=%5BWordpress+Plugin+Development%5D+How+To+Include+CSS+and+JavaScript+Conditionally+And+Only+When+Needed+By+The+Posts&amp;link=http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/&amp;notes=Introduction%0D%0A%20In%20this%20tutorial%2C%20I%20am%20going%20to%20introduce%20a%20Wordpress%20technique%20that%20I%20believe%20was%20unpublished%20until%20I%20raised%20the%20question%20a%20few%20days%20ago%20on%20the%20Wordpress%20forums.%0D%0AIn%20short%2C%20the%20problem%20I%20was%20trying%20to%20solve%20was%20plugins%20unnecessarily%20loading%20their%20JavaScript%20and%20CSS%20on%20%2Aevery%2A%20page%20of&amp;short_link=http://bit.ly/aH8tGB&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=%5BWordpress+Plugin+Development%5D+How+To+Include+CSS+and+JavaScript+Conditionally+And+Only+When+Needed+By+The+Posts&amp;link=http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/&amp;notes=Introduction%0D%0A%20In%20this%20tutorial%2C%20I%20am%20going%20to%20introduce%20a%20Wordpress%20technique%20that%20I%20believe%20was%20unpublished%20until%20I%20raised%20the%20question%20a%20few%20days%20ago%20on%20the%20Wordpress%20forums.%0D%0AIn%20short%2C%20the%20problem%20I%20was%20trying%20to%20solve%20was%20plugins%20unnecessarily%20loading%20their%20JavaScript%20and%20CSS%20on%20%2Aevery%2A%20page%20of&amp;short_link=http://bit.ly/aH8tGB&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=%5BWordpress+Plugin+Development%5D+How+To+Include+CSS+and+JavaScript+Conditionally+And+Only+When+Needed+By+The+Posts&amp;link=http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/&amp;notes=Introduction%0D%0A%20In%20this%20tutorial%2C%20I%20am%20going%20to%20introduce%20a%20Wordpress%20technique%20that%20I%20believe%20was%20unpublished%20until%20I%20raised%20the%20question%20a%20few%20days%20ago%20on%20the%20Wordpress%20forums.%0D%0AIn%20short%2C%20the%20problem%20I%20was%20trying%20to%20solve%20was%20plugins%20unnecessarily%20loading%20their%20JavaScript%20and%20CSS%20on%20%2Aevery%2A%20page%20of&amp;short_link=http://bit.ly/aH8tGB&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=%5BWordpress+Plugin+Development%5D+How+To+Include+CSS+and+JavaScript+Conditionally+And+Only+When+Needed+By+The+Posts&amp;link=http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/&amp;notes=Introduction%0D%0A%20In%20this%20tutorial%2C%20I%20am%20going%20to%20introduce%20a%20Wordpress%20technique%20that%20I%20believe%20was%20unpublished%20until%20I%20raised%20the%20question%20a%20few%20days%20ago%20on%20the%20Wordpress%20forums.%0D%0AIn%20short%2C%20the%20problem%20I%20was%20trying%20to%20solve%20was%20plugins%20unnecessarily%20loading%20their%20JavaScript%20and%20CSS%20on%20%2Aevery%2A%20page%20of&amp;short_link=http://bit.ly/aH8tGB&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts&amp;link=http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/&amp;notes=Introduction%0D%0A%20In%20this%20tutorial%2C%20I%20am%20going%20to%20introduce%20a%20Wordpress%20technique%20that%20I%20believe%20was%20unpublished%20until%20I%20raised%20the%20question%20a%20few%20days%20ago%20on%20the%20Wordpress%20forums.%0D%0AIn%20short%2C%20the%20problem%20I%20was%20trying%20to%20solve%20was%20plugins%20unnecessarily%20loading%20their%20JavaScript%20and%20CSS%20on%20%2Aevery%2A%20page%20of&amp;short_link=http://bit.ly/aH8tGB&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/" rel="bookmark" title="January 15, 2010">Follow-up To Loading CSS And JS Conditionally</a></li><li><a
href="http://beerpla.net/2010/01/31/how-to-remove-inline-hardcoded-recent-comments-sidebar-widget-style-from-your-wordpress-theme/" rel="bookmark" title="January 31, 2010">How To Remove Inline Hardcoded Recent Comments Sidebar Widget Style From Your WordPress Theme</a></li><li><a
href="http://beerpla.net/2010/11/06/how-to-dynamically-increase-memory-limits-when-interfacing-with-wordpress-using-xml-rpc-windows-live-writer-etc/" rel="bookmark" title="November 6, 2010">How To Dynamically Increase Memory Limits When Interfacing With WordPress Using XML-RPC (Windows Live Writer, Etc)</a></li><li><a
href="http://beerpla.net/2010/03/21/how-to-diagnose-and-fix-incorrect-post-comment-counts-in-wordpress/" rel="bookmark" title="March 21, 2010">How To Diagnose And Fix Incorrect Post Comment Counts In WordPress</a></li><li><a
href="http://beerpla.net/2010/02/20/how-to-view-a-specific-svn-revision-in-your-browser/" rel="bookmark" title="February 20, 2010">How To View A Specific SVN Revision In Your Browser</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2010%2F01%2F13%2Fwordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts%2F&amp;title=%5BWordPress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts" id="wpa2a_6"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/feed/</wfw:commentRss> <slash:comments>58</slash:comments> </item> <item><title>How To Make Firebug&#039;s JavaScript Debugger Break Inside Dynamic JavaScript Using The &#039;debugger&#039; Keyword (IE &amp; Chrome Too)</title><link>http://beerpla.net/2009/12/17/how-to-make-firebugs-javascript-debugger-break-inside-dynamic-javascript-using-the-debugger-keyword-ie-chrome-too/</link> <comments>http://beerpla.net/2009/12/17/how-to-make-firebugs-javascript-debugger-break-inside-dynamic-javascript-using-the-debugger-keyword-ie-chrome-too/#comments</comments> <pubDate>Thu, 17 Dec 2009 19:39:50 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Tips]]></category> <category><![CDATA[break]]></category> <category><![CDATA[breakpoint]]></category> <category><![CDATA[chrome]]></category> <category><![CDATA[debug]]></category> <category><![CDATA[debugger]]></category> <category><![CDATA[debugger keyword]]></category> <category><![CDATA[dynamic]]></category> <category><![CDATA[firebug]]></category> <category><![CDATA[Firefox]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[ie]]></category> <category><![CDATA[internet explorer]]></category> <category><![CDATA[keyword]]></category> <category><![CDATA[on-demand]]></category> <guid
isPermaLink="false">http://beerpla.net/2009/12/17/how-to-make-firebugs-javascript-debugger-break-inside-dynamic-javascript-using-the-debugger-keyword-ie-chrome-too/</guid> <description><![CDATA[<p><a
href="http://beerpla.net/wp-content/uploads/HowToMakeFirebugsJavaScriptDebuggerBreak_13D41/image.png" class="lightview" rel="gallery['1303']" title="image"><img
style="margin: 0px 10px 10px 0px; display: inline" title="image" alt="image" align="left" src="http://beerpla.net/wp-content/uploads/HowToMakeFirebugsJavaScriptDebuggerBreak_13D41/image_thumb.png" width="150" height="147" /></a> As a backend developer, I don&#039;t get to work with JavaScript much anymore. However, from time to time, a project would come along that uses JavaScript (specifically, AJAX) to load some backend data on the fly. Of course, nothing works 100% right away<strong><font
size="5">*</font></strong>, so I would often have to tweak this JavaScript and massage it until it does what I need.</p><p>Here&#039;s where Firebug comes in with its JavaScript debugger. I&#039;m used to using a debugger in every language I deal with, so using Firebug is a no brainer. Since it supports breakpoints, stopping execution and inspecting local variables and the rest of the scope generally beats alerts and console.logs for me.</p><p>Here&#039;s what a typical breakpoint looks ...<div
class=clear></div> <a
href="http://beerpla.net/2009/12/17/how-to-make-firebugs-javascript-debugger-break-inside-dynamic-javascript-using-the-debugger-keyword-ie-chrome-too/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></p>]]></description> <content:encoded><![CDATA[<p><a
href="http://beerpla.net/wp-content/uploads/HowToMakeFirebugsJavaScriptDebuggerBreak_13D41/image.png" class="lightview" rel="gallery['1303']" title="image"><img
style="margin: 0px 10px 10px 0px; display: inline" title="image" alt="image" align="left" src="http://beerpla.net/wp-content/uploads/HowToMakeFirebugsJavaScriptDebuggerBreak_13D41/image_thumb.png" width="150" height="147" /></a> As a backend developer, I don&#039;t get to work with JavaScript much anymore. However, from time to time, a project would come along that uses JavaScript (specifically, AJAX) to load some backend data on the fly. Of course, nothing works 100% right away<strong><font
size="5">*</font></strong>, so I would often have to tweak this JavaScript and massage it until it does what I need.</p><p>Here&#039;s where Firebug comes in with its JavaScript debugger. I&#039;m used to using a debugger in every language I deal with, so using Firebug is a no brainer. Since it supports breakpoints, stopping execution and inspecting local variables and the rest of the scope generally beats alerts and console.logs for me.</p><p>Here&#039;s what a typical breakpoint looks like in Firebug:</p><p><a
href="http://beerpla.net/wp-content/uploads/HowToMakeFirebugsJavaScriptDebuggerBreak_13D41/image_3.png" class="lightview" rel="gallery['1303']" title="Firebug JavaScript breakpoint triggered"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="Firebug JavaScript breakpoint triggered" alt="Firebug JavaScript breakpoint triggered" src="http://beerpla.net/wp-content/uploads/HowToMakeFirebugsJavaScriptDebuggerBreak_13D41/image_thumb_3.png" width="700" height="173" /></a></p><p>It&#039;s easy to set breakpoints in static scripts &#8211; just open the Scripts tab, select a JavaScript file from the dropdown menu, and click to the left of the wanted line number.</p><p>Then, when the page is reloaded, if your breakpoints are triggered, Firebug will pause script execution and transfer the control to you.</p><p><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="Setting Firebug JavaScript breakpoint" alt="Setting Firebug JavaScript breakpoint" src="http://beerpla.net/wp-content/uploads/HowToMakeFirebugsJavaScriptDebuggerBreak_13D41/image_4.png" width="593" height="179" /></p><p>In most cases, the method above is the only method of setting breakpoints you will ever need to use.</p><h2>The Problem With Dynamic JavaScript</h2><p>However, what if the JavaScript file where you need to set breakpoints is not static but instead dynamic (generated on the fly). If you set a breakpoint in this case and reload the page, the breakpoint will most likely disappear, especially if the JavaScript url is generated uniquely every time.</p><h2>The Solution</h2><p>If you have access to the source, the solution comes in the form of the</p><div
class="wp_syntax"><div
class="code"><pre>debugger;</pre></div></div><p>keyword. Just add it to your dynamic JavaScript generator or into any JavaScript file you have access to exactly where you want Firebug to break, and voila &#8211; it does.</p><p><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="JavaScript debugger keyword" alt="JavaScript debugger keyword" src="http://beerpla.net/wp-content/uploads/HowToMakeFirebugsJavaScriptDebuggerBreak_13D41/image_5.png" width="345" height="94" /></p><p>More so, this method also works in Google Chrome and <a
href="http://www.codestore.net/store.nsf/unid/DOMT-5UBUVW" rel="nofollow">IE (if you have Microsoft Script Debugger)</a>. Here is a screenshot of my Chrome Beta 4.0.266.0 triggering:</p><p><img
style="display: block; float: none; margin-left: auto; margin-right: auto" alt="Chrome JavaScript debugger" src="/for_www/chrome-js-debugger.png" /></p><p> I consider this feature relatively unpublished and therefore awesome because:</p><ul><li>it&#039;s hard to search for this specific meaning of the keyword &quot;debugger&quot; when Firebug itself is a debugger and it&#039;s a very popular word</li><li>nobody really reads documentation for Firebug, and even if they do, I haven&#039;t actually seen the debugger keyword mentioned</li><li>I didn&#039;t know about it until recently, even though I&#039;ve been using Firebug for years</li></ul><p>Of course, you need access to the code for this to work, so it&#039;s not going to work if you&#039;re trying to debug someone else&#039;s JavaScript.</p><p>And finally, don&#039;t forget to remove any traces of &#039;debugger&#039; from your code when you go live or your users will rightfully hunt you down.</p><h2>Credits And References:</h2><ul><li>suggested by a co-worker from <a
href="http://www.plaxo.com" rel="nofollow">Plaxo</a> &#8211; Russ. Thanks Russ!</li><li>some more interesting info at <a
href="http://stackoverflow.com/questions/858779/making-firebug-break-inside-dynamically-loaded-javascript" rel="nofollow">StackOverflow</a> and <a
href="http://devcenter.infragistics.com/Articles/ArticleTemplate.Aspx?ArticleID=2183" rel="nofollow">Infragistics</a>.</li></ul><p>Happy debugging!</p><p>(<strong><font
size="5">*</font></strong>) &#8211; if your project works 100% on the first pass, you must be either a magician or <a
href="http://stackoverflow.com/users/22656/jon-skeet" rel="nofollow">Jon Skeet</a> (<a
href="http://meta.stackoverflow.com/questions/9134/jon-skeet-facts" rel="nofollow">Jon Skeet Facts</a> &#8211; a-la Chuck Norris, a must read).</p><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=How+To+Make+Firebug%27s+JavaScript+Debugger+Break+Inside+Dynamic+JavaScript+Using+The+%27debugger%27+Keyword+%28IE+%26amp%3B+Chrome+Too%29&amp;link=http://beerpla.net/2009/12/17/how-to-make-firebugs-javascript-debugger-break-inside-dynamic-javascript-using-the-debugger-keyword-ie-chrome-too/&amp;notes=%20As%20a%20backend%20developer%2C%20I%20don%27t%20get%20to%20work%20with%20JavaScript%20much%20anymore.%20However%2C%20from%20time%20to%20time%2C%20a%20project%20would%20come%20along%20that%20uses%20JavaScript%20%28specifically%2C%20AJAX%29%20to%20load%20some%20backend%20data%20on%20the%20fly.%20Of%20course%2C%20nothing%20works%20100%25%20right%20away%2A%2C%20so%20I%20would%20often%20have%20to%20tweak%20this%20JavaScript%20&amp;short_link=http://bit.ly/aUKYre&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=How+To+Make+Firebug%27s+JavaScript+Debugger+Break+Inside+Dynamic+JavaScript+Using+The+%27debugger%27+Keyword+%28IE+%26amp%3B+Chrome+Too%29&amp;link=http://beerpla.net/2009/12/17/how-to-make-firebugs-javascript-debugger-break-inside-dynamic-javascript-using-the-debugger-keyword-ie-chrome-too/&amp;notes=%20As%20a%20backend%20developer%2C%20I%20don%27t%20get%20to%20work%20with%20JavaScript%20much%20anymore.%20However%2C%20from%20time%20to%20time%2C%20a%20project%20would%20come%20along%20that%20uses%20JavaScript%20%28specifically%2C%20AJAX%29%20to%20load%20some%20backend%20data%20on%20the%20fly.%20Of%20course%2C%20nothing%20works%20100%25%20right%20away%2A%2C%20so%20I%20would%20often%20have%20to%20tweak%20this%20JavaScript%20&amp;short_link=http://bit.ly/aUKYre&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=How+To+Make+Firebug%27s+JavaScript+Debugger+Break+Inside+Dynamic+JavaScript+Using+The+%27debugger%27+Keyword+%28IE+%26amp%3B+Chrome+Too%29&amp;link=http://beerpla.net/2009/12/17/how-to-make-firebugs-javascript-debugger-break-inside-dynamic-javascript-using-the-debugger-keyword-ie-chrome-too/&amp;notes=%20As%20a%20backend%20developer%2C%20I%20don%27t%20get%20to%20work%20with%20JavaScript%20much%20anymore.%20However%2C%20from%20time%20to%20time%2C%20a%20project%20would%20come%20along%20that%20uses%20JavaScript%20%28specifically%2C%20AJAX%29%20to%20load%20some%20backend%20data%20on%20the%20fly.%20Of%20course%2C%20nothing%20works%20100%25%20right%20away%2A%2C%20so%20I%20would%20often%20have%20to%20tweak%20this%20JavaScript%20&amp;short_link=http://bit.ly/aUKYre&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=How+To+Make+Firebug%27s+JavaScript+Debugger+Break+Inside+Dynamic+JavaScript+Using+The+%27debugger%27+Keyword+%28IE+%26amp%3B+Chrome+Too%29&amp;link=http://beerpla.net/2009/12/17/how-to-make-firebugs-javascript-debugger-break-inside-dynamic-javascript-using-the-debugger-keyword-ie-chrome-too/&amp;notes=%20As%20a%20backend%20developer%2C%20I%20don%27t%20get%20to%20work%20with%20JavaScript%20much%20anymore.%20However%2C%20from%20time%20to%20time%2C%20a%20project%20would%20come%20along%20that%20uses%20JavaScript%20%28specifically%2C%20AJAX%29%20to%20load%20some%20backend%20data%20on%20the%20fly.%20Of%20course%2C%20nothing%20works%20100%25%20right%20away%2A%2C%20so%20I%20would%20often%20have%20to%20tweak%20this%20JavaScript%20&amp;short_link=http://bit.ly/aUKYre&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=How+To+Make+Firebug%27s+JavaScript+Debugger+Break+Inside+Dynamic+JavaScript+Using+The+%27debugger%27+Keyword+%28IE+%26amp%3B+Chrome+Too%29&amp;link=http://beerpla.net/2009/12/17/how-to-make-firebugs-javascript-debugger-break-inside-dynamic-javascript-using-the-debugger-keyword-ie-chrome-too/&amp;notes=%20As%20a%20backend%20developer%2C%20I%20don%27t%20get%20to%20work%20with%20JavaScript%20much%20anymore.%20However%2C%20from%20time%20to%20time%2C%20a%20project%20would%20come%20along%20that%20uses%20JavaScript%20%28specifically%2C%20AJAX%29%20to%20load%20some%20backend%20data%20on%20the%20fly.%20Of%20course%2C%20nothing%20works%20100%25%20right%20away%2A%2C%20so%20I%20would%20often%20have%20to%20tweak%20this%20JavaScript%20&amp;short_link=http://bit.ly/aUKYre&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=How+To+Make+Firebug%27s+JavaScript+Debugger+Break+Inside+Dynamic+JavaScript+Using+The+%27debugger%27+Keyword+%28IE+%26amp%3B+Chrome+Too%29&amp;link=http://beerpla.net/2009/12/17/how-to-make-firebugs-javascript-debugger-break-inside-dynamic-javascript-using-the-debugger-keyword-ie-chrome-too/&amp;notes=%20As%20a%20backend%20developer%2C%20I%20don%27t%20get%20to%20work%20with%20JavaScript%20much%20anymore.%20However%2C%20from%20time%20to%20time%2C%20a%20project%20would%20come%20along%20that%20uses%20JavaScript%20%28specifically%2C%20AJAX%29%20to%20load%20some%20backend%20data%20on%20the%20fly.%20Of%20course%2C%20nothing%20works%20100%25%20right%20away%2A%2C%20so%20I%20would%20often%20have%20to%20tweak%20this%20JavaScript%20&amp;short_link=http://bit.ly/aUKYre&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=How+To+Make+Firebug%27s+JavaScript+Debugger+Break+Inside+Dynamic+JavaScript+Using+The+%27debugger%27+Keyword+%28IE+%26amp%3B+Chrome+Too%29&amp;link=http://beerpla.net/2009/12/17/how-to-make-firebugs-javascript-debugger-break-inside-dynamic-javascript-using-the-debugger-keyword-ie-chrome-too/&amp;notes=%20As%20a%20backend%20developer%2C%20I%20don%27t%20get%20to%20work%20with%20JavaScript%20much%20anymore.%20However%2C%20from%20time%20to%20time%2C%20a%20project%20would%20come%20along%20that%20uses%20JavaScript%20%28specifically%2C%20AJAX%29%20to%20load%20some%20backend%20data%20on%20the%20fly.%20Of%20course%2C%20nothing%20works%20100%25%20right%20away%2A%2C%20so%20I%20would%20often%20have%20to%20tweak%20this%20JavaScript%20&amp;short_link=http://bit.ly/aUKYre&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=How%20To%20Make%20Firebug%27s%20JavaScript%20Debugger%20Break%20Inside%20Dynamic%20JavaScript%20Using%20The%20%27debugger%27%20Keyword%20%28IE%20%26amp%3B%20Chrome%20Too%29&amp;link=http://beerpla.net/2009/12/17/how-to-make-firebugs-javascript-debugger-break-inside-dynamic-javascript-using-the-debugger-keyword-ie-chrome-too/&amp;notes=%20As%20a%20backend%20developer%2C%20I%20don%27t%20get%20to%20work%20with%20JavaScript%20much%20anymore.%20However%2C%20from%20time%20to%20time%2C%20a%20project%20would%20come%20along%20that%20uses%20JavaScript%20%28specifically%2C%20AJAX%29%20to%20load%20some%20backend%20data%20on%20the%20fly.%20Of%20course%2C%20nothing%20works%20100%25%20right%20away%2A%2C%20so%20I%20would%20often%20have%20to%20tweak%20this%20JavaScript%20&amp;short_link=http://bit.ly/aUKYre&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/" rel="bookmark" title="January 13, 2010">[WordPress Plugin Development] How To Include CSS and JavaScript Conditionally And Only When Needed By The Posts</a></li><li><a
href="http://beerpla.net/2010/01/31/heres-an-exclusive-10-off-nuspheres-phped-coupon-also-includes-nucoder-and-phpdoc-discount-code/" rel="bookmark" title="January 31, 2010">[Updated for 2012] Here&#039;s An Exclusive 10% Off NuSphere PHPEd Discount Coupon Code (Also Includes NuCoder And PHPDoc)</a></li><li><a
href="http://beerpla.net/2009/06/09/how-to-make-your-site-lightning-fast-by-compressing-deflategzip-your-html-javascript-css-xml-etc-in-apache/" rel="bookmark" title="June 9, 2009">How To Make Your Site Lightning Fast* By Compressing (deflate/gzip) Your HTML, Javascript, CSS, XML, etc In Apache</a></li><li><a
href="http://beerpla.net/2010/11/06/how-to-dynamically-increase-memory-limits-when-interfacing-with-wordpress-using-xml-rpc-windows-live-writer-etc/" rel="bookmark" title="November 6, 2010">How To Dynamically Increase Memory Limits When Interfacing With WordPress Using XML-RPC (Windows Live Writer, Etc)</a></li><li><a
href="http://beerpla.net/2012/04/13/how-to-fix-incomplete-wordpress-wxr-exports/" rel="bookmark" title="April 13, 2012">How To Fix Incomplete WordPress (WXR) Exports</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2009%2F12%2F17%2Fhow-to-make-firebugs-javascript-debugger-break-inside-dynamic-javascript-using-the-debugger-keyword-ie-chrome-too%2F&amp;title=How%20To%20Make%20Firebug%26%23039%3Bs%20JavaScript%20Debugger%20Break%20Inside%20Dynamic%20JavaScript%20Using%20The%20%26%23039%3Bdebugger%26%23039%3B%20Keyword%20%28IE%20%26amp%3B%20Chrome%20Too%29" id="wpa2a_8"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2009/12/17/how-to-make-firebugs-javascript-debugger-break-inside-dynamic-javascript-using-the-debugger-keyword-ie-chrome-too/feed/</wfw:commentRss> <slash:comments>15</slash:comments> </item> <item><title>Hidden Features Of Perl, PHP, Javascript, C, C++, C#, Java, Ruby, Python, And Others [Collection Of Incredibly Useful Lists]</title><link>http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/</link> <comments>http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/#comments</comments> <pubDate>Sun, 21 Jun 2009 19:38:56 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[C]]></category> <category><![CDATA[C Sharp]]></category> <category><![CDATA[C++]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[Databases]]></category> <category><![CDATA[Java]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[Perl]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Python]]></category> <category><![CDATA[Ruby]]></category> <category><![CDATA[asp.net]]></category> <category><![CDATA[bash]]></category> <category><![CDATA[code]]></category> <category><![CDATA[delphi]]></category> <category><![CDATA[Eclipse]]></category> <category><![CDATA[emacs]]></category> <category><![CDATA[f#]]></category> <category><![CDATA[feature]]></category> <category><![CDATA[featured]]></category> <category><![CDATA[flash]]></category> <category><![CDATA[framework]]></category> <category><![CDATA[greasemonkey]]></category> <category><![CDATA[haskell]]></category> <category><![CDATA[hidden]]></category> <category><![CDATA[http]]></category> <category><![CDATA[jquery]]></category> <category><![CDATA[language]]></category> <category><![CDATA[lua]]></category> <category><![CDATA[mod_rewrite]]></category> <category><![CDATA[objective-c]]></category> <category><![CDATA[oracle]]></category> <category><![CDATA[program]]></category> <category><![CDATA[regex]]></category> <category><![CDATA[ror]]></category> <category><![CDATA[ruby on rails]]></category> <category><![CDATA[scala]]></category> <category><![CDATA[secret]]></category> <category><![CDATA[spring]]></category> <category><![CDATA[tcl]]></category> <category><![CDATA[vb.net]]></category> <category><![CDATA[xpath]]></category> <category><![CDATA[xslt]]></category> <guid
isPermaLink="false">http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/</guid> <description><![CDATA[<h2 align="left">Introduction</h2><p><a
href="http://www.stackoverflow.com">StackOverflow</a> is an amazing site for coding questions. It was created by <a
href="http://twitter.com/Spolsky" rel="nofollow">Joel Spolsky</a> of <a
href="http://joelonsoftware.com" rel="nofollow">joelonsoftware.com</a>, <a
href="http://twitter.com/codinghorror" rel="nofollow">Jeff Atwood</a> of <a
href="http://codinghorror.com" rel="nofollow">codinghorror.com</a>, and some other incredibly smart guys who truly care about user experience. I have been a total fan of SO since it went mainstream and it&#039;s now a borderline addiction (you can see my StackOverflow badge on the right sidebar).</p><h2 align="left">The Story</h2><p
align="left"><div
class="note"><div
class="noteimportant"></div></div></p><p
align="left"><strong>Update 6/21/09</strong>: This server is currently under very heavy load (10-200), even with caching plugins enabled. Please bear with me as I try to resolve the situation.</p><p
align="left">Feel free to <a
href="http://www.addtoany.com/share_save?&#38;linkurl=http%3A%2F%2Fbeerpla.net%2F2009%2F06%2F21%2Fhidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists%2F&#38;linkname=Hidden%20Features%20Of%20Perl%2C%20PHP%2C%20Javascript%2C%20C%2C%20C%2B%2B%2C%20C%23%2C%20Java%2C%20Ruby%2C%20Python%2C%20And%20Others%20%5BCollection%20Of%20Incredibly%20Useful%20Lists%5D">bookmark this page</a> and return to it later when the fires have been put out.</p><p
align="left"><strong>Update 06/21/09</strong>: I think I&#039;ve got the situation ...<div
class=clear></div> <a
href="http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></p>]]></description> <content:encoded><![CDATA[<h2 align="left">Introduction</h2><p><a
href="http://www.stackoverflow.com">StackOverflow</a> is an amazing site for coding questions. It was created by <a
href="http://twitter.com/Spolsky" rel="nofollow">Joel Spolsky</a> of <a
href="http://joelonsoftware.com" rel="nofollow">joelonsoftware.com</a>, <a
href="http://twitter.com/codinghorror" rel="nofollow">Jeff Atwood</a> of <a
href="http://codinghorror.com" rel="nofollow">codinghorror.com</a>, and some other incredibly smart guys who truly care about user experience. I have been a total fan of SO since it went mainstream and it&#039;s now a borderline addiction (you can see my StackOverflow badge on the right sidebar).</p><h2 align="left">The Story</h2><p
align="left"><div
class="note"><div
class="noteimportant"></p><p
align="left"><strong>Update 6/21/09</strong>: This server is currently under very heavy load (10-200), even with caching plugins enabled. Please bear with me as I try to resolve the situation.</p><p
align="left">Feel free to <a
href="http://www.addtoany.com/share_save?&amp;linkurl=http%3A%2F%2Fbeerpla.net%2F2009%2F06%2F21%2Fhidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists%2F&amp;linkname=Hidden%20Features%20Of%20Perl%2C%20PHP%2C%20Javascript%2C%20C%2C%20C%2B%2B%2C%20C%23%2C%20Java%2C%20Ruby%2C%20Python%2C%20And%20Others%20%5BCollection%20Of%20Incredibly%20Useful%20Lists%5D">bookmark this page</a> and return to it later when the fires have been put out.</p><p
align="left"><strong>Update 06/21/09</strong>: I think I&#039;ve got the situation under control now. The load is between 0 and 3 now and pages load relatively fast. I will be posting about the getting redditted/delicioused experience later.</p><p
align="left"><strong>Update 06/23/09</strong>: Added jQuery, Greasemonkey, Ruby on Rails, and Objective-C, broke databases into their own section, and sorted everything alphabetically.</p><p
align="left"><strong>Update 06/23/09</strong>: Added Scala, Lua, TCL, F#, Regex, and HTTP.</p><p
align="left"><strong>Update 07/21/09</strong>: Added ActionScript3/Flex, Erlang, PL/SQL, Silverlight, VBA, VHDL, WPF/XAML.</p><p
align="left"><strong>Update 10/24/09</strong>: Added Flash development/language/IDE, Emacs, Xpath/Xslt, Spring framework.</p><p
align="left"><strong>Update 01/18/10</strong>: Added Android (asked by yours truly), Qt, Django, Windows.Forms, R, Lisp, x86 assembly, Grails.</p><p
align="left"></div></div></p><p>So, one day someone at StackOverflow started a &quot;Hidden features of&quot; post about a famous language (I don&#039;t feel like finding out which one was first exactly), and it turned out to be so popular that other posts in the same series started popping up.</p><p>Such questions were quickly turned into community wikis, for the purposes of harvesting and organizing information coming from the best developers on the planet and voted by users of the site. There are literally hundreds of answers, sorted by votes.</p><p><div
class="note"><div
class="notetip">The Hidden Features series is great for people who are new to a certain language. It shows the ropes and tricks, all in one place, in the most concise manner possible. Even pros oftentimes find features of their favorite language that they&#039;d never heard about.</div></div></p><h2 align="center">Hidden Features Of</h2><h3>Programming Languages</h3><h4><a
href="http://stackoverflow.com/questions/1103705/hidden-features-of-actionscript3-flex">Hidden features of ActionScript3 / Flex</a></h4><h4><a
href="http://stackoverflow.com/questions/54929/hidden-features-of-asp-net">Hidden features of ASP.NET </a></h4><h4><a
href="http://stackoverflow.com/questions/1574308/hidden-features-of-x86-assembly-language" rel="nofollow">Hidden features of x86 assembly</a></h4><h4><a
href="http://stackoverflow.com/questions/132241/hidden-features-of-c">Hidden features of C</a></h4><h4><a
href="http://stackoverflow.com/questions/75538/hidden-features-of-c">Hidden features of C++</a></h4><h4><a
href="http://stackoverflow.com/questions/9033/hidden-features-of-c">Hidden features of C#</a></h4><h4><a
href="http://stackoverflow.com/questions/1853653/hidden-features-of-coldfusion" rel="nofollow">Hidden features of ColdFusion</a></h4><h4><a
href="http://stackoverflow.com/questions/125008/hidden-features-of-d">Hidden features of D </a></h4><h4><a
href="http://stackoverflow.com/questions/102254/hidden-features-of-delphi" rel="nofollow">Hidden features of Delphi</a></h4><h4><a
href="http://stackoverflow.com/questions/1063497/hidden-features-of-erlang" rel="nofollow">Hidden features of Erlang</a></h4><h4><a
href="http://stackoverflow.com/questions/181613/hidden-features-of-f">Hidden features of F# </a></h4><h4><a
href="http://stackoverflow.com/questions/1160680/hidden-features-tricks-of-flash-development-flash-language-as2-3-and-flash-id" rel="nofollow">Hidden features of Flash development, Flash language (AS2/3), and Flash IDE</a></h4><h4><a
href="http://stackoverflow.com/questions/15496/hidden-features-of-java">Hidden features of Java</a></h4><h4><a
href="http://stackoverflow.com/questions/61088/hidden-features-of-javascript">Hidden features of JavaScript</a></h4><h4><a
href="http://stackoverflow.com/questions/211216/hidden-features-of-haskell">Hidden features of Haskell </a></h4><h4><a
href="http://stackoverflow.com/questions/1598854/hidden-features-of-emacs-lisp" rel="nofollow">Hidden features of Lisp</a></h4><h4><a
href="http://stackoverflow.com/questions/523867/hidden-features-of-lua">Hidden features of Lua </a></h4><h4><a
href="http://stackoverflow.com/questions/211616/hidden-features-of-objective-c">Hidden features of Objective-C </a></h4><h4><a
href="http://stackoverflow.com/questions/161872/hidden-features-of-perl">Hidden features of Perl</a></h4><h4><a
href="http://stackoverflow.com/questions/61401/hidden-features-of-php">Hidden features of PHP</a></h4><h4><a
href="http://stackoverflow.com/questions/101268/hidden-features-of-python">Hidden features of Python</a></h4><h4><a
href="http://stackoverflow.com/questions/1682874/hidden-features-of-r" rel="nofollow">Hidden features of R</a></h4><h4><a
href="http://stackoverflow.com/questions/63998/hidden-features-of-ruby">Hidden features of Ruby</a></h4><h4><a
href="http://stackoverflow.com/questions/709679/hidden-features-of-ruby-on-rails">Hidden features of Ruby on Rails </a></h4><h4><a
href="http://stackoverflow.com/questions/1025181/hidden-features-of-scala">Hidden features of Scala </a></h4><h4><a
href="http://stackoverflow.com/questions/1031450/are-there-any-undocumented-features-in-silverlight">Hidden features of Silverlight</a></h4><h4><a
href="http://stackoverflow.com/questions/1596139/hidden-features-and-dark-corners-of-stl" rel="nofollow">Hidden features and Dark Corners of STL?</a></h4><h4><a
href="http://stackoverflow.com/questions/1024711/hidden-features-of-tcl-tk">Hidden features of TCL/TK</a></h4><h4><a
href="http://stackoverflow.com/questions/102084/hidden-features-of-vb-net">Hidden features of VB.Net </a></h4><h4><a
href="http://stackoverflow.com/questions/1070863/hidden-features-of-vba">Hidden features of VBA</a></h4><h3>Databases</h3><h4><a
href="http://stackoverflow.com/questions/368858/hidden-features-of-mysql">Hidden features of MySQL </a></h4><h4><a
href="http://stackoverflow.com/questions/381231/hidden-features-in-oracle">Hidden features of Oracle </a></h4><h4><a
href="http://stackoverflow.com/questions/1031485/hidden-features-of-pl-sql">Hidden features of PL/SQL</a></h4><h4><a
href="http://stackoverflow.com/questions/761327/hidden-features-of-postgresql">Hidden features of PostgreSQL </a></h4><h4><a
href="http://stackoverflow.com/questions/121243/hidden-features-of-sql-server">Hidden features of SQL Server </a></h4><h3>Mobile</h3><h4><a
href="http://stackoverflow.com/questions/1619133/hidden-features-of-android-development" rel="nofollow">Hidden features of Android development</a></h4><h3>Other</h3><h4><a
href="http://stackoverflow.com/questions/211378/hidden-features-of-bash">Hidden features of Bash</a> &#8211; also see my <a
href="http://beerpla.net/2008/12/22/mastering-the-linux-shell-bash-shortcuts-explained/">bash cheatsheet</a>.</h4><h4><a
href="http://stackoverflow.com/questions/628407/css-hidden-features">Hidden features of CSS</a></h4><h4><a
href="http://stackoverflow.com/questions/1858520/hidden-features-of-django" rel="nofollow">Hidden features of Django</a></h4><h4><a
href="http://stackoverflow.com/questions/54886/hidden-features-tricks-for-eclipse">Hidden features of Eclipse </a></h4><h4><a
href="http://stackoverflow.com/questions/1598854/hidden-features-of-emacs-lisp" rel="nofollow">Hidden features of Emacs</a></h4><h4><a
href="http://stackoverflow.com/questions/1330531/hidden-features-of-grails" rel="nofollow">Hidden features of Grails</a></h4><h4><a
href="http://stackoverflow.com/questions/121167/hidden-features-of-greasemonkey">Hidden features of Greasemonkey </a></h4><h4><a
href="http://stackoverflow.com/questions/954327/hidden-features-of-html">Hidden features of HTML </a></h4><h4><a
href="http://stackoverflow.com/questions/954894/hidden-features-of-http">Hidden features of HTTP </a></h4><h4><a
href="http://stackoverflow.com/questions/121965/hidden-or-not-widely-known-features-of-jquery">Hidden features of jQuery</a></h4><h4><a
href="http://stackoverflow.com/questions/286004/hidden-features-of-modrewrite">Hidden features of mod_rewrite </a></h4><h4><a
href="http://stackoverflow.com/questions/1826458/hidden-features-of-qt" rel="nofollow">Hidden features of Qt</a></h4><h4><a
href="http://stackoverflow.com/questions/868181/hidden-features-of-regex">Hidden features of RegEx </a></h4><h4><a
href="http://stackoverflow.com/questions/1416423/hidden-features-of-spring-framework">Hidden features of Spring framework </a></h4><h4><a
href="http://stackoverflow.com/questions/1025699/hidden-features-of-vhdl">Hidden features of VHDL</a></h4><h4><a
href="http://stackoverflow.com/questions/100420/hidden-features-of-visual-studio-2005-2008">Hidden features of Visual Studio (2005-2008) </a></h4><h4><a
href="http://stackoverflow.com/questions/1777303/hidden-features-of-windows-forms" rel="nofollow">Hidden features of Windows.Forms</a></h4><h4><a
href="http://stackoverflow.com/questions/1124769/hidden-features-of-wpf-and-xaml">Hidden features of WPF and XAML</a></h4><h4><a
href="http://stackoverflow.com/questions/1521851/hidden-features-of-xpathxslt">Hidden features of Xpath+Xslt</a></h4><p>I will try to maintain this list, adding new languages that join the series as I find them. Now go learn something new!</p><div
class='post_blob_1'>Real <a
href="http://www.test-king.com/exams/70-432.htm">70-432</a> exam preparation with help of easy to understand <a
href="http://www.test-king.com/exams/220-702.htm">220-702</a> notes and <a
href="http://www.test-king.com/exams/640-553.htm">640-553</a> practice questions.</div><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Features+Of+Perl%2C+PHP%2C+Javascript%2C+C%2C+C%2B%2B%2C+C%23%2C+Java%2C+Ruby%2C+Python%2C+And+Others+%5BCollection+Of+Incredibly+Useful+Lists%5D&amp;link=http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/&amp;notes=Introduction%0D%0AStackOverflow%20is%20an%20amazing%20site%20for%20coding%20questions.%20It%20was%20created%20by%20Joel%20Spolsky%20of%20joelonsoftware.com%2C%20Jeff%20Atwood%20of%20codinghorror.com%2C%20and%20some%20other%20incredibly%20smart%20guys%20who%20truly%20care%20about%20user%20experience.%20I%20have%20been%20a%20total%20fan%20of%20SO%20since%20it%20went%20mainstream%20and%20it%27s%20now%20a&amp;short_link=http://bit.ly/capw5J&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Features+Of+Perl%2C+PHP%2C+Javascript%2C+C%2C+C%2B%2B%2C+C%23%2C+Java%2C+Ruby%2C+Python%2C+And+Others+%5BCollection+Of+Incredibly+Useful+Lists%5D&amp;link=http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/&amp;notes=Introduction%0D%0AStackOverflow%20is%20an%20amazing%20site%20for%20coding%20questions.%20It%20was%20created%20by%20Joel%20Spolsky%20of%20joelonsoftware.com%2C%20Jeff%20Atwood%20of%20codinghorror.com%2C%20and%20some%20other%20incredibly%20smart%20guys%20who%20truly%20care%20about%20user%20experience.%20I%20have%20been%20a%20total%20fan%20of%20SO%20since%20it%20went%20mainstream%20and%20it%27s%20now%20a&amp;short_link=http://bit.ly/capw5J&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Features+Of+Perl%2C+PHP%2C+Javascript%2C+C%2C+C%2B%2B%2C+C%23%2C+Java%2C+Ruby%2C+Python%2C+And+Others+%5BCollection+Of+Incredibly+Useful+Lists%5D&amp;link=http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/&amp;notes=Introduction%0D%0AStackOverflow%20is%20an%20amazing%20site%20for%20coding%20questions.%20It%20was%20created%20by%20Joel%20Spolsky%20of%20joelonsoftware.com%2C%20Jeff%20Atwood%20of%20codinghorror.com%2C%20and%20some%20other%20incredibly%20smart%20guys%20who%20truly%20care%20about%20user%20experience.%20I%20have%20been%20a%20total%20fan%20of%20SO%20since%20it%20went%20mainstream%20and%20it%27s%20now%20a&amp;short_link=http://bit.ly/capw5J&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Features+Of+Perl%2C+PHP%2C+Javascript%2C+C%2C+C%2B%2B%2C+C%23%2C+Java%2C+Ruby%2C+Python%2C+And+Others+%5BCollection+Of+Incredibly+Useful+Lists%5D&amp;link=http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/&amp;notes=Introduction%0D%0AStackOverflow%20is%20an%20amazing%20site%20for%20coding%20questions.%20It%20was%20created%20by%20Joel%20Spolsky%20of%20joelonsoftware.com%2C%20Jeff%20Atwood%20of%20codinghorror.com%2C%20and%20some%20other%20incredibly%20smart%20guys%20who%20truly%20care%20about%20user%20experience.%20I%20have%20been%20a%20total%20fan%20of%20SO%20since%20it%20went%20mainstream%20and%20it%27s%20now%20a&amp;short_link=http://bit.ly/capw5J&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Features+Of+Perl%2C+PHP%2C+Javascript%2C+C%2C+C%2B%2B%2C+C%23%2C+Java%2C+Ruby%2C+Python%2C+And+Others+%5BCollection+Of+Incredibly+Useful+Lists%5D&amp;link=http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/&amp;notes=Introduction%0D%0AStackOverflow%20is%20an%20amazing%20site%20for%20coding%20questions.%20It%20was%20created%20by%20Joel%20Spolsky%20of%20joelonsoftware.com%2C%20Jeff%20Atwood%20of%20codinghorror.com%2C%20and%20some%20other%20incredibly%20smart%20guys%20who%20truly%20care%20about%20user%20experience.%20I%20have%20been%20a%20total%20fan%20of%20SO%20since%20it%20went%20mainstream%20and%20it%27s%20now%20a&amp;short_link=http://bit.ly/capw5J&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Features+Of+Perl%2C+PHP%2C+Javascript%2C+C%2C+C%2B%2B%2C+C%23%2C+Java%2C+Ruby%2C+Python%2C+And+Others+%5BCollection+Of+Incredibly+Useful+Lists%5D&amp;link=http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/&amp;notes=Introduction%0D%0AStackOverflow%20is%20an%20amazing%20site%20for%20coding%20questions.%20It%20was%20created%20by%20Joel%20Spolsky%20of%20joelonsoftware.com%2C%20Jeff%20Atwood%20of%20codinghorror.com%2C%20and%20some%20other%20incredibly%20smart%20guys%20who%20truly%20care%20about%20user%20experience.%20I%20have%20been%20a%20total%20fan%20of%20SO%20since%20it%20went%20mainstream%20and%20it%27s%20now%20a&amp;short_link=http://bit.ly/capw5J&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Features+Of+Perl%2C+PHP%2C+Javascript%2C+C%2C+C%2B%2B%2C+C%23%2C+Java%2C+Ruby%2C+Python%2C+And+Others+%5BCollection+Of+Incredibly+Useful+Lists%5D&amp;link=http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/&amp;notes=Introduction%0D%0AStackOverflow%20is%20an%20amazing%20site%20for%20coding%20questions.%20It%20was%20created%20by%20Joel%20Spolsky%20of%20joelonsoftware.com%2C%20Jeff%20Atwood%20of%20codinghorror.com%2C%20and%20some%20other%20incredibly%20smart%20guys%20who%20truly%20care%20about%20user%20experience.%20I%20have%20been%20a%20total%20fan%20of%20SO%20since%20it%20went%20mainstream%20and%20it%27s%20now%20a&amp;short_link=http://bit.ly/capw5J&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden%20Features%20Of%20Perl%2C%20PHP%2C%20Javascript%2C%20C%2C%20C%2B%2B%2C%20C%23%2C%20Java%2C%20Ruby%2C%20Python%2C%20And%20Others%20%5BCollection%20Of%20Incredibly%20Useful%20Lists%5D&amp;link=http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/&amp;notes=Introduction%0D%0AStackOverflow%20is%20an%20amazing%20site%20for%20coding%20questions.%20It%20was%20created%20by%20Joel%20Spolsky%20of%20joelonsoftware.com%2C%20Jeff%20Atwood%20of%20codinghorror.com%2C%20and%20some%20other%20incredibly%20smart%20guys%20who%20truly%20care%20about%20user%20experience.%20I%20have%20been%20a%20total%20fan%20of%20SO%20since%20it%20went%20mainstream%20and%20it%27s%20now%20a&amp;short_link=http://bit.ly/capw5J&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2009/10/24/are-you-a-stackoverflow-com-superuser-com-serverfault-com-fan-heres-a-greasemonkey-script-to-keep-track-of-your-accounts-on-all-of-them/" rel="bookmark" title="October 24, 2009">StackOverflow.com, SuperUser.com, ServerFault.com Fan? Here&#039;s A Greasemonkey Script To Keep Track Of All Your Accounts</a></li><li><a
href="http://beerpla.net/2009/09/03/comparison-between-solr-and-sphinx-search-servers-solr-vs-sphinx-fight/" rel="bookmark" title="September 3, 2009">Comparison Between Solr And Sphinx Search Servers (Solr Vs Sphinx &#8211; Fight!)</a></li><li><a
href="http://beerpla.net/2009/03/17/twitter-autocomplete-auto-url-expansion-auto-url-shortener-auto-pagination-rt-button-nested-replies-inline-media-embed-search-tabs-and-more/" rel="bookmark" title="March 17, 2009">Twitter.com Autocomplete, Auto URL Expansion, Auto URL Shortener, RT Button, Nested Replies, Inline Media Embed, Search Tabs, And More</a></li><li><a
href="http://beerpla.net/2010/01/18/wordpress-developers-how-do-you-make-a-living-poll-discussion/" rel="bookmark" title="January 18, 2010">WordPress Developers &#8211; How Do You Make A Living [Poll + Discussion]?</a></li><li><a
href="http://beerpla.net/2009/08/18/delicious-com-quietly-rolls-out-domain-and-url-searchingfiltering-finally/" rel="bookmark" title="August 18, 2009">Delicious.com [Quietly] Rolls Out Domain And Url Searching/Filtering. Finally!</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2009%2F06%2F21%2Fhidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists%2F&amp;title=Hidden%20Features%20Of%20Perl%2C%20PHP%2C%20Javascript%2C%20C%2C%20C%2B%2B%2C%20C%23%2C%20Java%2C%20Ruby%2C%20Python%2C%20And%20Others%20%5BCollection%20Of%20Incredibly%20Useful%20Lists%5D" id="wpa2a_10"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/feed/</wfw:commentRss> <slash:comments>18</slash:comments> </item> <item><title>How To Make Your Site Lightning Fast* By Compressing (deflate/gzip) Your HTML, Javascript, CSS, XML, etc In Apache</title><link>http://beerpla.net/2009/06/09/how-to-make-your-site-lightning-fast-by-compressing-deflategzip-your-html-javascript-css-xml-etc-in-apache/</link> <comments>http://beerpla.net/2009/06/09/how-to-make-your-site-lightning-fast-by-compressing-deflategzip-your-html-javascript-css-xml-etc-in-apache/#comments</comments> <pubDate>Tue, 09 Jun 2009 17:02:00 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[CSS]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Technology]]></category> <category><![CDATA[Tutorials]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[apache]]></category> <category><![CDATA[compress]]></category> <category><![CDATA[compression]]></category> <category><![CDATA[deflate]]></category> <category><![CDATA[fast]]></category> <category><![CDATA[faster]]></category> <category><![CDATA[gzip]]></category> <category><![CDATA[html]]></category> <category><![CDATA[js]]></category> <category><![CDATA[minify]]></category> <category><![CDATA[mod_deflate]]></category> <category><![CDATA[smaller]]></category> <category><![CDATA[text]]></category> <category><![CDATA[xml]]></category> <guid
isPermaLink="false">http://beerpla.net/?p=982</guid> <description><![CDATA[<p><span
style="font-size: xx-small">* Lightning Fast is a blatant exaggeration. Got you to look though, didn&#039;t it?</span></p><h2>Introduction</h2><p>Whether you are a web developer or a self-hosting business owner, the only excuse for not activating compression capabilities of your web server can be that you didn&#039;t know about it. And now that you are reading this, there is no excuse left at all.</p><p>Here is how big a single page of this blog was before compression was enabled on CSS and Javascript files (computed by <a
href="http://developer.yahoo.com/yslow/" rel="nofollow">YSlow</a>):</p><p><a
href="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_3.png" class="lightview" rel="gallery['982']" title="image"><img
style="display: inline; margin-left: 0px; margin-right: 0px" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_thumb_3.png" width="132" height="24" /></a></p><p>And here it is after compression:</p><p><a
href="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_4.png" class="lightview" rel="gallery['982']" title="image"><img
style="display: inline; margin-left: 0px; margin-right: 0px" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_thumb_4.png" width="136" height="28" /></a></p><p>As you see, the difference is quite substantial &#8211; almost 30% savings.</p><p>Compressing your HTML, XML, Javascript, CSS, etc pages will mean less data transferred between the server and the ...<div
class=clear></div> <a
href="http://beerpla.net/2009/06/09/how-to-make-your-site-lightning-fast-by-compressing-deflategzip-your-html-javascript-css-xml-etc-in-apache/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></p>]]></description> <content:encoded><![CDATA[<p><span
style="font-size: xx-small">* Lightning Fast is a blatant exaggeration. Got you to look though, didn&#039;t it?</span></p><h2>Introduction</h2><p>Whether you are a web developer or a self-hosting business owner, the only excuse for not activating compression capabilities of your web server can be that you didn&#039;t know about it. And now that you are reading this, there is no excuse left at all.</p><p>Here is how big a single page of this blog was before compression was enabled on CSS and Javascript files (computed by <a
href="http://developer.yahoo.com/yslow/" rel="nofollow">YSlow</a>):</p><p><a
href="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_3.png" class="lightview" rel="gallery['982']" title="image"><img
style="display: inline; margin-left: 0px; margin-right: 0px" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_thumb_3.png" width="132" height="24" /></a></p><p>And here it is after compression:</p><p><a
href="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_4.png" class="lightview" rel="gallery['982']" title="image"><img
style="display: inline; margin-left: 0px; margin-right: 0px" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_thumb_4.png" width="136" height="28" /></a></p><p>As you see, the difference is quite substantial &#8211; almost 30% savings.</p><p>Compressing your HTML, XML, Javascript, CSS, etc pages will mean less data transferred between the server and the client which:</p><ul><li>reduces the bandwidth usage.</li><li>provides faster page rendering which in turn leads to less user frustration, higher conversion rates, lower bounce rate, etc etc etc.</li></ul><p>Compression is especially important for users with slow connections as every kilobyte of your code is that much more painful to them.</p><p>Compression can be very effective &#8211; you can easily shrink your text, code (HTML, XML, Javascript, CSS, etc) to 10% of the original size (of course, your mileage may vary). 100KB page that needs only 10KB to transfer? Sign me up!</p><p>So, before I talk about the solution, let me describe what exactly happens when compression is turned on and how it affects older browsers that don&#039;t support it.</p><p><div
class="note"><div
class="notetip"></p><p><a
href="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_17.png" class="lightview" rel="gallery['982']" title="image"><img
style="margin: 0px auto 10px; display: block; float: none" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_thumb_17.png" width="292" height="177" /></a> <strong>Are you using jQuery?</strong></p><p>Did you know that a minified jQuery file is <strong>55KB</strong>? In order to achieve the advertised <strong>19KB</strong>, you would still need to compress the .js file using the methods listed here.</div></div></p><h2>Compression Mechanism Explained</h2><p>In order for compression to work in the first place, the web server (Apache in my example) needs to support it. This is achieved by enabling one of Apache modules called mod_deflate. The server will then be able to compress the data to the DEFLATE standard using either the zlib (also known as deflate) or gzip implementations. Yeah, DEFLATE is both the standard the one of its implementations, for those confused. I know I was. This is best described in <a
href="http://en.wikipedia.org/wiki/Gzip#Other_uses" rel="nofollow">this Wikipedia article</a>.</p><p>The following mechanism is used:</p><ul><li>the server with a compression extension enabled is able to serve either compressed (smaller) or uncompressed (larger) pages, depending on what the client supports.</li><li>the client (that is, your browser) sends a special header called &quot;Accept-Encoding&quot; listing the DEFLATE implementations it&#039;s capable of decompressing. For example &quot;gzip,deflate&quot;.</li><li>the server picks the best compression supported by the client (if any), compresses the files, and sends them over to the client.</li><li>the client receives the compressed files and decompresses them.</li></ul><p><div
class="note"><div
class="notetip"><strong>Are you using a load blancer?</strong></p><p>If you are using a load balancer, it may already be configured to compress pages that pass through it. In that case, there is no need to separately configure compression on your web servers. In fact, it should be off to save CPU.</div></div></p><h2>Are Your Pages Already Compressed? Test Them!</h2><p>If you are not sure whether you are already serving compressed pages or not, test them! My favorite way is by using <a
href="http://www.charlesproxy.com/" rel="nofollow">Charles HTTP Debugger</a>. Another option is by downloading <a
href="http://getfirebug.com/" rel="nofollow">Firebug</a> for Firefox and installing Yahoo&#039;s <a
href="http://developer.yahoo.com/yslow/" rel="nofollow">YSlow</a> or Google&#039;s <a
href="http://code.google.com/speed/page-speed/" rel="nofollow">Page Speed</a>. Just look at the response headers to see if compression is on (look for the Content-Encoding header). Here are some before and after examples:</p><h3>Theme CSS</h3><p><a
href="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_5.png" class="lightview" rel="gallery['982']" title="image"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_thumb_5.png" width="427" height="36" /></a></p><p>Before:</p><p><a
href="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_6.png" class="lightview" rel="gallery['982']" title="image"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_thumb_6.png" width="266" height="136" /></a></p><p>After:</p><p><a
href="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_7.png" class="lightview" rel="gallery['982']" title="image"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_thumb_7.png" width="267" height="161" /></a></p><h3>jQuery</h3><p><a
href="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_8.png" class="lightview" rel="gallery['982']" title="image"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_thumb_8.png" width="469" height="39" /></a></p><p>Before:</p><p><a
href="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_9.png" class="lightview" rel="gallery['982']" title="image"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_thumb_9.png" width="263" height="132" /></a></p><p>After:</p><p><a
href="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_10.png" class="lightview" rel="gallery['982']" title="image"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_thumb_10.png" width="273" height="168" /></a></p><h2>Solution</h2><p>Create a .htaccess file in the top directory of your site with the following contents:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td
class="code"><pre># DEFLATE by type - html, text, css, xml
AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml
&nbsp;
# DEFLATE by type - javascript
AddOutputFilterByType DEFLATE application/x-javascript application/javascript text/javascript text/x-js text/x-javascript
&nbsp;
# DEFLATE by extension
AddOutputFilter DEFLATE js css htm html xml</pre></td></tr></table></div><p>Alternatively, you could put these lines into your Apache config within the Directory directive.</p><p>The <a
href="http://httpd.apache.org/docs/2.2/mod/core.html#addoutputfilterbytype" rel="nofollow">AddOutputFilterByType</a> directive adds DEFLATE filters to certain MIME types. I tried to assemble some of the common ones but feel free to add more, as each server may be configured differently and give out MIME types different from mine.</p><p><div
class="note"><div
class="notetip">You can find your own server&#039;s MIME type definitions in the file that the TypesConfig directive is pointing to (mine is /etc/mime.types).</div></div></p><p>The <a
href="http://httpd.apache.org/docs/2.2/mod/mod_mime.html#addoutputfilter" rel="nofollow">AddOutputFilter</a> directive binds the DEFLATE filter to specific file extensions, just in case they are not served with a proper MIME type. Feel free to add to this list as well.</p><h2>Caveats</h2><p>1. In order to use this whole compression/deflate/gzip business, your Apache server must first have mod_deflate enabled. Without it, you will get the HTTP 500 error (Internal Server error). You can check which mods you already have enabled by checking with the output of phpinfo() function.</p><p><a
href="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_13.png" class="lightview" rel="gallery['982']" title="image"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_thumb_13.png" width="606" height="97" /></a></p><p>In order to enable mod_deflate, uncomment the line with &quot;deflate_module&quot; in your Apache config file. The location of this config file is highly dependant on your system. Some examples include</p><ul><li>/etc/apache2/httpd.conf</li><li>/etc/httpd/conf/httpd.conf</li><li>c:\wamp\bin\apache\Apache2.2.11\conf\httpd.conf</li><li>some other place where your system stores Apache config files (read the special note below for OpenSUSE).</li></ul><p>Here&#039;s what you should have:</p><div
class="wp_syntax"><div
class="code"><pre>LoadModule deflate_module modules/mod_deflate.so</pre></div></div><p>On OpenSUSE, you actually enable modules a bit differently. Go to /etc/sysconfig/apache2 and look for APACHE_MODULES=. Then add &quot;deflate&quot; to the list, if it&#039;s not already there.</p><p>Now, restart Apache and check the output of phpinfo() again.</p><p>2. Adding AddOutputFilter and AddOutputFilterByType to .htaccess requires such overrides to be authorized by the main Apache configuration for that directory, otherwise it will return error 500 as well. The option you are looking for is called &quot;AllowOverride&quot; and mine was set to &quot;AllowOverride AuthConfig&quot; which wasn&#039;t enough. Changing it to</p><div
class="wp_syntax"><div
class="code"><pre>AllowOverride AuthConfig FileInfo</pre></div></div><p>or just</p><div
class="wp_syntax"><div
class="code"><pre>AllowOverride All</pre></div></div><p>fixes the problem. You can find more info about AllowOverride <a
href="http://httpd.apache.org/docs/1.3/mod/core.html#allowoverride" rel="nofollow">here</a>.</p><p>3. In WordPress, if you are using Google Gears (<a
href="http://en.blog.wordpress.com/2008/07/02/gears/" rel="nofollow">Turbo mode</a>) for caching some core WordPress files, they will not show up compressed. That is because they&#039;re not served by the remote server but rather reside locally (think of it as permanent cache). I was very confused at first when I didn&#039;t see jQuery.js in the HTTP log and YSlow reported it uncompressed.</p><h2>Are you a WordPress user?</h2><p>If you are a WordPress user, don&#039;t assume WordPress is going to automatically compress your pages. In fact, as you install more and more plugins, the payload becomes larger and larger with those additional CSS and Javascript files.</p><p>You owe it to yourself and to your users to immediately enable compression on your blog.</p><p>Here is what happened after I enabled compression on this blog.</p><p>Before:</p><p><a
href="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_11.png" class="lightview" rel="gallery['982']" title="image"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_thumb_11.png" width="676" height="418" /></a></p><p>After:</p><p><a
href="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_12.png" class="lightview" rel="gallery['982']" title="image"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_thumb_12.png" width="440" height="115" /></a></p><h2>Bonus &#8211; WP Minify</h2><p>For even better results, I suggest you have a look at my good friend and talented WordPress master Thaya&#039;s plugin called <a
href="http://omninoggin.com/wordpress-plugins/wp-minify-wordpress-plugin/">WP Minify</a>. It preprocesses and aggregates all or most of your CSS and Javascript into just 2 files, thus saving on the number of HTTP requests. It also minifies content to achieve smaller size.</p><p>My blog before WP Minify:</p><p><a
href="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_14.png" class="lightview" rel="gallery['982']" title="image"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_thumb_14.png" width="413" height="62" /></a></p><p>After WP Minify:</p><p><a
href="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_15.png" class="lightview" rel="gallery['982']" title="image"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/HowToCompressdeflategzipYourPagesJavascr_11A9F/image_thumb_15.png" width="408" height="59" /></a></p><p>&#160;</p><p>That&#039;s all folks. Let me know if something was unclear and I&#039;ll be glad to clarify it.</p><p>A few references that pointed me in the right direction and allowed me to provide a more complete solution:</p><ul><li><a
title="http://brightscape.net/compress-jquery-even-further/" href="http://brightscape.net/compress-jquery-even-further/">http://brightscape.net/compress-jquery-even-further/</a></li><li><a
title="http://brightscape.net/compress-your-web-pages-with-mod_deflate/" href="http://brightscape.net/compress-your-web-pages-with-mod_deflate/">http://brightscape.net/compress-your-web-pages-with-mod_deflate/</a></li></ul><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=How+To+Make+Your+Site+Lightning+Fast%2A+By+Compressing+%28deflate%2Fgzip%29+Your+HTML%2C+Javascript%2C+CSS%2C+XML%2C+etc+In+Apache&amp;link=http://beerpla.net/2009/06/09/how-to-make-your-site-lightning-fast-by-compressing-deflategzip-your-html-javascript-css-xml-etc-in-apache/&amp;notes=%2A%20Lightning%20Fast%20is%20a%20blatant%20exaggeration.%20Got%20you%20to%20look%20though%2C%20didn%27t%20it%3F%20%20Introduction%20%20Whether%20you%20are%20a%20web%20developer%20or%20a%20self-hosting%20business%20owner%2C%20the%20only%20excuse%20for%20not%20activating%20compression%20capabilities%20of%20your%20web%20server%20can%20be%20that%20you%20didn%27t%20know%20about%20it.%20And%20now%20that%20you%20are%20re&amp;short_link=http://bit.ly/c6Upm4&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=How+To+Make+Your+Site+Lightning+Fast%2A+By+Compressing+%28deflate%2Fgzip%29+Your+HTML%2C+Javascript%2C+CSS%2C+XML%2C+etc+In+Apache&amp;link=http://beerpla.net/2009/06/09/how-to-make-your-site-lightning-fast-by-compressing-deflategzip-your-html-javascript-css-xml-etc-in-apache/&amp;notes=%2A%20Lightning%20Fast%20is%20a%20blatant%20exaggeration.%20Got%20you%20to%20look%20though%2C%20didn%27t%20it%3F%20%20Introduction%20%20Whether%20you%20are%20a%20web%20developer%20or%20a%20self-hosting%20business%20owner%2C%20the%20only%20excuse%20for%20not%20activating%20compression%20capabilities%20of%20your%20web%20server%20can%20be%20that%20you%20didn%27t%20know%20about%20it.%20And%20now%20that%20you%20are%20re&amp;short_link=http://bit.ly/c6Upm4&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=How+To+Make+Your+Site+Lightning+Fast%2A+By+Compressing+%28deflate%2Fgzip%29+Your+HTML%2C+Javascript%2C+CSS%2C+XML%2C+etc+In+Apache&amp;link=http://beerpla.net/2009/06/09/how-to-make-your-site-lightning-fast-by-compressing-deflategzip-your-html-javascript-css-xml-etc-in-apache/&amp;notes=%2A%20Lightning%20Fast%20is%20a%20blatant%20exaggeration.%20Got%20you%20to%20look%20though%2C%20didn%27t%20it%3F%20%20Introduction%20%20Whether%20you%20are%20a%20web%20developer%20or%20a%20self-hosting%20business%20owner%2C%20the%20only%20excuse%20for%20not%20activating%20compression%20capabilities%20of%20your%20web%20server%20can%20be%20that%20you%20didn%27t%20know%20about%20it.%20And%20now%20that%20you%20are%20re&amp;short_link=http://bit.ly/c6Upm4&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=How+To+Make+Your+Site+Lightning+Fast%2A+By+Compressing+%28deflate%2Fgzip%29+Your+HTML%2C+Javascript%2C+CSS%2C+XML%2C+etc+In+Apache&amp;link=http://beerpla.net/2009/06/09/how-to-make-your-site-lightning-fast-by-compressing-deflategzip-your-html-javascript-css-xml-etc-in-apache/&amp;notes=%2A%20Lightning%20Fast%20is%20a%20blatant%20exaggeration.%20Got%20you%20to%20look%20though%2C%20didn%27t%20it%3F%20%20Introduction%20%20Whether%20you%20are%20a%20web%20developer%20or%20a%20self-hosting%20business%20owner%2C%20the%20only%20excuse%20for%20not%20activating%20compression%20capabilities%20of%20your%20web%20server%20can%20be%20that%20you%20didn%27t%20know%20about%20it.%20And%20now%20that%20you%20are%20re&amp;short_link=http://bit.ly/c6Upm4&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=How+To+Make+Your+Site+Lightning+Fast%2A+By+Compressing+%28deflate%2Fgzip%29+Your+HTML%2C+Javascript%2C+CSS%2C+XML%2C+etc+In+Apache&amp;link=http://beerpla.net/2009/06/09/how-to-make-your-site-lightning-fast-by-compressing-deflategzip-your-html-javascript-css-xml-etc-in-apache/&amp;notes=%2A%20Lightning%20Fast%20is%20a%20blatant%20exaggeration.%20Got%20you%20to%20look%20though%2C%20didn%27t%20it%3F%20%20Introduction%20%20Whether%20you%20are%20a%20web%20developer%20or%20a%20self-hosting%20business%20owner%2C%20the%20only%20excuse%20for%20not%20activating%20compression%20capabilities%20of%20your%20web%20server%20can%20be%20that%20you%20didn%27t%20know%20about%20it.%20And%20now%20that%20you%20are%20re&amp;short_link=http://bit.ly/c6Upm4&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=How+To+Make+Your+Site+Lightning+Fast%2A+By+Compressing+%28deflate%2Fgzip%29+Your+HTML%2C+Javascript%2C+CSS%2C+XML%2C+etc+In+Apache&amp;link=http://beerpla.net/2009/06/09/how-to-make-your-site-lightning-fast-by-compressing-deflategzip-your-html-javascript-css-xml-etc-in-apache/&amp;notes=%2A%20Lightning%20Fast%20is%20a%20blatant%20exaggeration.%20Got%20you%20to%20look%20though%2C%20didn%27t%20it%3F%20%20Introduction%20%20Whether%20you%20are%20a%20web%20developer%20or%20a%20self-hosting%20business%20owner%2C%20the%20only%20excuse%20for%20not%20activating%20compression%20capabilities%20of%20your%20web%20server%20can%20be%20that%20you%20didn%27t%20know%20about%20it.%20And%20now%20that%20you%20are%20re&amp;short_link=http://bit.ly/c6Upm4&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=How+To+Make+Your+Site+Lightning+Fast%2A+By+Compressing+%28deflate%2Fgzip%29+Your+HTML%2C+Javascript%2C+CSS%2C+XML%2C+etc+In+Apache&amp;link=http://beerpla.net/2009/06/09/how-to-make-your-site-lightning-fast-by-compressing-deflategzip-your-html-javascript-css-xml-etc-in-apache/&amp;notes=%2A%20Lightning%20Fast%20is%20a%20blatant%20exaggeration.%20Got%20you%20to%20look%20though%2C%20didn%27t%20it%3F%20%20Introduction%20%20Whether%20you%20are%20a%20web%20developer%20or%20a%20self-hosting%20business%20owner%2C%20the%20only%20excuse%20for%20not%20activating%20compression%20capabilities%20of%20your%20web%20server%20can%20be%20that%20you%20didn%27t%20know%20about%20it.%20And%20now%20that%20you%20are%20re&amp;short_link=http://bit.ly/c6Upm4&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=How%20To%20Make%20Your%20Site%20Lightning%20Fast%2A%20By%20Compressing%20%28deflate%2Fgzip%29%20Your%20HTML%2C%20Javascript%2C%20CSS%2C%20XML%2C%20etc%20In%20Apache&amp;link=http://beerpla.net/2009/06/09/how-to-make-your-site-lightning-fast-by-compressing-deflategzip-your-html-javascript-css-xml-etc-in-apache/&amp;notes=%2A%20Lightning%20Fast%20is%20a%20blatant%20exaggeration.%20Got%20you%20to%20look%20though%2C%20didn%27t%20it%3F%20%20Introduction%20%20Whether%20you%20are%20a%20web%20developer%20or%20a%20self-hosting%20business%20owner%2C%20the%20only%20excuse%20for%20not%20activating%20compression%20capabilities%20of%20your%20web%20server%20can%20be%20that%20you%20didn%27t%20know%20about%20it.%20And%20now%20that%20you%20are%20re&amp;short_link=http://bit.ly/c6Upm4&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2008/03/29/beer-planet-upgraded-to-wordpress-25/" rel="bookmark" title="March 29, 2008">Beer Planet Upgraded To WordPress 2.5</a></li><li><a
href="http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/" rel="bookmark" title="January 13, 2010">[WordPress Plugin Development] How To Include CSS and JavaScript Conditionally And Only When Needed By The Posts</a></li><li><a
href="http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/" rel="bookmark" title="June 21, 2009">Hidden Features Of Perl, PHP, Javascript, C, C++, C#, Java, Ruby, Python, And Others [Collection Of Incredibly Useful Lists]</a></li><li><a
href="http://beerpla.net/2006/06/12/rendr-a-live-awesome-csshtml-rendering-tool/" rel="bookmark" title="June 12, 2006">Rendr &#8211; a Live Awesome CSS/HTML Rendering Tool</a></li><li><a
href="http://beerpla.net/2007/10/12/cpan-the-perl-module-manager/" rel="bookmark" title="October 12, 2007">cpan &#8211; The Perl Module Manager</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2009%2F06%2F09%2Fhow-to-make-your-site-lightning-fast-by-compressing-deflategzip-your-html-javascript-css-xml-etc-in-apache%2F&amp;title=How%20To%20Make%20Your%20Site%20Lightning%20Fast%2A%20By%20Compressing%20%28deflate%2Fgzip%29%20Your%20HTML%2C%20Javascript%2C%20CSS%2C%20XML%2C%20etc%20In%20Apache" id="wpa2a_12"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2009/06/09/how-to-make-your-site-lightning-fast-by-compressing-deflategzip-your-html-javascript-css-xml-etc-in-apache/feed/</wfw:commentRss> <slash:comments>19</slash:comments> </item> </channel> </rss>
