<?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>Web 3.0, 6 Bladed Razors, 7 Minute Abs &#187; Other</title>
	<atom:link href="http://www.zachleat.com/web/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zachleat.com/web</link>
	<description></description>
	<lastBuildDate>Mon, 06 Feb 2012 17:09:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>jQuery Bug: IE reports incorrect $.browser.version</title>
		<link>http://www.zachleat.com/web/jquery-bug-ie-reports-incorrect-browserversion/</link>
		<comments>http://www.zachleat.com/web/jquery-bug-ie-reports-incorrect-browserversion/#comments</comments>
		<pubDate>Sun, 19 Oct 2008 06:18:34 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/?p=150</guid>
		<description><![CDATA[I&#8217;ve witnessed installations of IE where the navigator.userAgent reported both MSIE 6.0 and MSIE 7.0 in the same string, when Internet Explorer 7 is the one that&#8217;s really installed. Turns out, this is problematic for jQuery version 1.2.6, as it parses the double version userAgent as Internet Explorer 6, which may cause problems with your [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve witnessed installations of IE where the navigator.userAgent reported both MSIE 6.0 and MSIE 7.0 in the same string, when Internet Explorer 7 is the one that&#8217;s really installed.  Turns out, this is problematic for jQuery version 1.2.6, as it parses the double version userAgent as Internet Explorer 6, which may cause problems with your code if you&#8217;re using $.browser.version.</p>
<p>You can monitor the <a href="http://dev.jquery.com/ticket/3169">jQuery bug</a> in the bug tracker, or see the original research performed by <a href="http://jamazon.co.uk/web/2008/03/14/jquerybrowserversion-doesnt-recognise-ie7/">Jamie Thompson</a>.  Here&#8217;s a better workaround that merges two different approaches used on Jamie&#8217;s page, which fixes $.browser.version instead of using $.browser.msie6.  This is to be considered temporary until the next (fixed) version of jQuery comes out.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery.<span style="color: #660066;">browser</span>.<span style="color: #660066;">version</span> <span style="color: #339933;">=</span> jQuery.<span style="color: #660066;">browser</span>.<span style="color: #660066;">msie</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009966; font-style: italic;">/msie 7\.0/i</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span>navigator.<span style="color: #660066;">userAgent</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span>
	<span style="color: #3366CC;">&quot;7.0&quot;</span> <span style="color: #339933;">:</span>
	jQuery.<span style="color: #660066;">browser</span>.<span style="color: #660066;">version</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/jquery-bug-ie-reports-incorrect-browserversion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dear IE6: Please Cache my Images.</title>
		<link>http://www.zachleat.com/web/dear-ie6-please-cache-my-images/</link>
		<comments>http://www.zachleat.com/web/dear-ie6-please-cache-my-images/#comments</comments>
		<pubDate>Sun, 19 Oct 2008 05:47:44 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[linkedin]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/?p=149</guid>
		<description><![CDATA[A few months ago, I took on a new role at Union Pacific Railroad as the lead architect for an internal project: a Union Pacific UI Library used in our IT department on all new web-based projects. Based on jQuery, it is similar to a project like jQuery UI, but it has a few more [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago, I took on a new role at <a href="http://www.unionpacific.jobs/careers/explore/prof/index.shtml">Union Pacific Railroad</a> as the lead architect for an internal project: a Union Pacific UI Library used in our IT department on all new web-based projects.  Based on <a href="http://jquery.com/">jQuery</a>, it is similar to a project like <a href="http://ui.jquery.com/">jQuery UI</a>, but it has a few more components and they&#8217;re branded to our color scheme and programmed to our usability requirements.</p>
<p>The project has allowed me to expand my knowledge of browser quirks, improving my frontend-fu with every closed support ticket.  What does that mean for you?  More blogs posts.  Learn from my mistakes (and from those I&#8217;ve inherited).</p>
<p>This week presented an interesting, albeit decreasingly relevant scenario, where a customer was seeing performance problems when loading a simple web page in Internet Explorer 6.  The only hint to the root cause was a claim that he witnessed &#8220;400 items remaining&#8221; in his status bar.  Naturally, this took awhile, but at least we had somewhere to start: Apache access logs.</p>
<p>Consider the following (jQuery) code to <strong>add three new images</strong> to the page using JavaScript:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html&gt;
    &lt;head&gt;
		&lt;script type=&quot;text/javascript&quot; src=&quot;jquery-1.2.6.min.js&quot;&gt;&lt;/script&gt;
		&lt;style type=&quot;text/css&quot;&gt;
		img.bacon { width: 100px; height: 67px; background-image: url(bacon.png); }
		&lt;/style&gt;
   &lt;/head&gt;
    &lt;body&gt;
        &lt;script type=&quot;text/javascript&quot;&gt;
		jQuery(function() {
			jQuery('body').append('&lt;img src=&quot;spacer.png&quot; class=&quot;bacon&quot;/&gt;');
			jQuery('body').append('&lt;img src=&quot;spacer.png&quot; class=&quot;bacon&quot;/&gt;');
			jQuery('body').append('&lt;img src=&quot;spacer.png&quot; class=&quot;bacon&quot;/&gt;');
		});
        &lt;/script&gt;
    &lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>Note how each image being added dynamically has a <strong>background-image</strong> as well.</p>
<p>In a <strong>normal</strong> web browser (read: Internet Explorer 7+, Firefox *), this would result in the following Apache <code>access.log</code> (with an empty browser cache) with only <strong>4 HTTP requests</strong> (ignoring favicon.ico, which is irrelevant to this study):</p>
<blockquote><p>
127.0.0.1 &#8211; - [18/Oct/2008:22:59:09 -0500] &#8220;GET /ie6cache/ HTTP/1.1&#8243; 200 657<br />
127.0.0.1 &#8211; - [18/Oct/2008:22:59:09 -0500] &#8220;GET /ie6cache/jquery-1.2.6.min.js HTTP/1.1&#8243; 200 55774<br />
127.0.0.1 &#8211; - [18/Oct/2008:22:59:09 -0500] &#8220;GET /ie6cache/spacer.png HTTP/1.1&#8243; 200 207<br />
127.0.0.1 &#8211; - [18/Oct/2008:22:59:09 -0500] &#8220;GET /ie6cache/bacon.png HTTP/1.1&#8243; 200 5416
</p></blockquote>
<p>In Internet Explorer 6, however, this is the resulting Apache <code>access.log</code> (empty browser cache) with <strong>8 HTTP requests</strong>:</p>
<blockquote><p>
127.0.0.1 &#8211; - [18/Oct/2008:22:57:48 -0500] &#8220;GET /ie6cache/ HTTP/1.1&#8243; 200 657<br />
127.0.0.1 &#8211; - [18/Oct/2008:22:57:48 -0500] &#8220;GET /ie6cache/jquery-1.2.6.min.js HTTP/1.1&#8243; 200 55774<br />
127.0.0.1 &#8211; - [18/Oct/2008:22:57:48 -0500] &#8220;GET /ie6cache/spacer.png HTTP/1.1&#8243; 200 207<br />
127.0.0.1 &#8211; - [18/Oct/2008:22:57:48 -0500] &#8220;GET /ie6cache/spacer.png HTTP/1.1&#8243; 200 207<br />
127.0.0.1 &#8211; - [18/Oct/2008:22:57:48 -0500] &#8220;GET /ie6cache/bacon.png HTTP/1.1&#8243; 200 5416<br />
127.0.0.1 &#8211; - [18/Oct/2008:22:57:48 -0500] &#8220;GET /ie6cache/bacon.png HTTP/1.1&#8243; 200 5416<br />
127.0.0.1 &#8211; - [18/Oct/2008:22:57:48 -0500] &#8220;GET /ie6cache/spacer.png HTTP/1.1&#8243; 200 207<br />
127.0.0.1 &#8211; - [18/Oct/2008:22:57:48 -0500] &#8220;GET /ie6cache/bacon.png HTTP/1.1&#8243; 200 5416
</p></blockquote>
<p>When a web browser parses your markup and sees three image tags with identical src attributes, it makes only one HTTP request to the server for that image, and the rest of the images are loaded from the local web browser cache (no more HTTP requests are made).  This is standard behavior for all modern web browsers.  But in IE6, as you can see from the above log, made 3 requests to the server for both <code>spacer.png</code> and <code>bacon.png</code>.  Why?</p>
<p>Turns out there are two independent issues at play here:</p>
<ol>
<li>The classic <em><a href="http://www.mister-pixel.com/#Content__state=is_that_simple">IE6 background-image flicker</a></em> problem.  This has been documented extensively, and the problem is that IE6 bypasses its local web browser cache for any image requests made for CSS background-images inserted on the page dynamically.  The good news for this one is that the fix is a simple one.

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>jQuery.<span style="color: #660066;">browser</span>.<span style="color: #660066;">msie</span> <span style="color: #339933;">&amp;&amp;</span> parseInt<span style="color: #009900;">&#40;</span>jQuery.<span style="color: #660066;">browser</span>.<span style="color: #660066;">version</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">6</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
    document.<span style="color: #660066;">execCommand</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;BackgroundImageCache&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span>err<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Note the simple check for IE 6 execution only.  This is optional, but keep in mind that this problem is not present in IE7+.  During your testing, also keep in mind that Mister Pixel reports (and I can confirm) that once you run this command, this setting <strong>will persist in your browser</strong>, even if you empty your cache and remove the code from your scripts.  You&#8217;ll need to close your browser window to reset the setting to default.</p>
<p><em>See also <a href="http://dean.edwards.name/my/flicker.html">Dean Edwards&#8217;</a> and <a href="http://www.hedgerwow.com/360/bugs/dom-fix-ie6-background-image-flicker.html">Hedger Wang&#8217;s</a> studies on this issue for more information.</em>  But this is really only half the problem.  This will fix the duplicate bacon.png HTTP requests, but we&#8217;ll still see 3 spacer.png HTTP requests in our logs.
</li>
<li>The other issue is a separate but equal problem with IE6 caching.  When inserting images with identical <code>src</code> attributes, IE6 will always go to the server (which means an extra HTTP request) for a new image.  This is a <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;319546">documented <em>feature</em> in IE6</a>, and the fix they have listed on their page isn&#8217;t ideal.  The best solution here is to <strong>eliminate the need for <code>spacer.png</code></strong> altogether.  I can put these bacon background&#8217;s on a div tag just as easily, emphasizing pragmatism over semantics in this case (it&#8217;s a small sacrifice, you&#8217;ll live).  If you have an <code>&lt;img&gt;</code> tag with a source you actually need, why not move it to the background image on a div tag?  Unfortunately here, the takeaway is that <strong>your logic may need to be restructured</strong> to workaround this issue.
<p>See also <a href="http://www.bazon.net/mishoo/articles.epl?art_id=958">Mihai Bazon&#8217;s study</a> for more information, but do keep in mind that grouping this issue with the background flicker problem is an incorrect categorization.  They are two separate issues and the fixes represented on that page don&#8217;t really fix the issue at all.  Implementing server side caching as a &#8220;fix&#8221; is like using a bandaid for a tourniquet. You don&#8217;t want an HTTP request to go to the server <strong>at all</strong>, I don&#8217;t care if the response is a 200 OK or a 304 Not Modified.  No HTTP request is always going to be faster than a server side cached response.
</li>
</ol>
<p>These issues will present themselves more frequently if you have the &#8220;Every visit to the page&#8221; caching option enabled in your Internet Tools in Internet Explorer.  Good luck.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/dear-ie6-please-cache-my-images/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Forgive My Feed</title>
		<link>http://www.zachleat.com/web/forgive-my-feed/</link>
		<comments>http://www.zachleat.com/web/forgive-my-feed/#comments</comments>
		<pubDate>Sat, 19 Apr 2008 04:56:57 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[Self]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/?p=128</guid>
		<description><![CDATA[This is going through a bit of maintenance. I&#8217;m tagging and recategorizing my old posts, so feel free to &#8220;mark all as read&#8221; if you get a bunch of new items.]]></description>
			<content:encoded><![CDATA[<p>This is going through a bit of maintenance.  I&#8217;m tagging and recategorizing my old posts, so feel free to &#8220;mark all as read&#8221; if you get a bunch of new items.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/forgive-my-feed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beaten to the Spiked Punch</title>
		<link>http://www.zachleat.com/web/beaten-to-the-spiked-punch/</link>
		<comments>http://www.zachleat.com/web/beaten-to-the-spiked-punch/#comments</comments>
		<pubDate>Sat, 03 Mar 2007 20:25:28 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[Self]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/03/03/beaten-to-the-spiked-punch/</guid>
		<description><![CDATA[No matter what you think, someone else is thinking the same thing. I guess this guy might just be living with my same brain waves but a year or so earlier. It has never been a better time to just stop thinking.]]></description>
			<content:encoded><![CDATA[<p>No matter what you think, <a href="http://hyku.com/blog/archives/000786.html">someone else is thinking the same thing</a>.  I guess this guy might just be living with my same brain waves but a year or so earlier.  It has never been a better time to just stop thinking.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/beaten-to-the-spiked-punch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Technorati Spider</title>
		<link>http://www.zachleat.com/web/technorati-spider/</link>
		<comments>http://www.zachleat.com/web/technorati-spider/#comments</comments>
		<pubDate>Wed, 21 Feb 2007 06:23:44 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[Self]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/02/21/technorati-spider/</guid>
		<description><![CDATA[This is a link to my brand baby spanking new Technorati Profile. Revel.]]></description>
			<content:encoded><![CDATA[<p>This is a link to my brand baby spanking new <a href="http://technorati.com/claim/p4ycz9yef8" rel="me">Technorati Profile</a>.  Revel.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/technorati-spider/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

