<?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>chromakode &#187; detect</title>
	<atom:link href="http://www.chromakode.com/tag/detect/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chromakode.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 30 Apr 2010 17:50:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Letting IE6 down easy</title>
		<link>http://www.chromakode.com/2008/12/letting-ie6-down-easy/</link>
		<comments>http://www.chromakode.com/2008/12/letting-ie6-down-easy/#comments</comments>
		<pubDate>Sun, 21 Dec 2008 10:50:50 +0000</pubDate>
		<dc:creator>chromakode</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[detect]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.chromakode.com/?p=375</guid>
		<description><![CDATA[If you were browsing using Internet Explorer 6 right now, here&#8217;s what you&#8217;d see:

Note: Internet Explorer version 6 or lower has been detected.
Your browser cannot display this page properly. For compatibility, this page has been reduced to a low-graphics mode. To view this site the way it was intended, please upgrade Internet Explorer or switch [...]]]></description>
			<content:encoded><![CDATA[<p>If you were browsing using <a href="http://en.wikipedia.org/wiki/IE6">Internet Explorer 6</a> right now, here&#8217;s what you&#8217;d see:</p>
<div class="ie6alert">
<h1>Note: Internet Explorer version 6 or lower has been detected.</h1>
<p>Your browser cannot display this page properly. For compatibility, this page has been reduced to a low-graphics mode. To view this site the way it was intended, please upgrade Internet Explorer or <a href="http://browsehappy.com/browsers/">switch to another browser</a>.</div>
<p>This morning, I bit the bullet and finally took a look at my site in IE6. A few minutes later, after fruitlessly experimenting with compatibility scripts, I decided to formally drop IE6 support for this site. I&#8217;ve long felt that it&#8217;s a waste of effort to cater to browsers that don&#8217;t meet developers halfway, so I&#8217;ve typically put minimal effort into designing my pages around them. I&#8217;ve also felt that the best way to finally stab the stake into IE6&#8217;s heart is to simply let pages look bad and out of date in it. I&#8217;m pleased to see that this practice is finally gaining <a href="http://idroppedie6.com/">critical mass</a>.</p>
<p>Thus, I set out to find some JavaScript glue to formally explain my intentions to visitors. After surveying the options, some of which were a bit too <a href="http://www.stopie6.org/">preachy</a>, and others a bit too <a href="http://www.stopie6.com/">mild</a>, I decided to write my own little IE6 handler script.</p>
<p>My script, IE6unstyled.js, adds the header seen at the top of this post. The page is then displayed <strong>unstyled</strong> (based on <a href="http://dorward.me.uk/">David Dorward<a/>&#8217;s <a href="http://dorward.me.uk/software/disablecss/">bookmarklet</a>), which works well if your page degrades gracefully. Rather than allow IE6 to mangle the page layout, I choose to simply give it the raw content. This frees me from worrying about the presentation in IE6 and restores the layout to a basic, usable state. I feel that this projects the right message: to experience the current web to its fullest, you&#8217;d best switch from using IE6.</p>
<p><span id="more-375"></span><br />
Here&#8217;s the script.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">window.<span class="kw3">onload</span> <span class="sy0">=</span> <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
	<span class="kw1">for</span><span class="br0">&#40;</span>i<span class="sy0">=</span><span class="nu0">0</span><span class="sy0">;</span>i<span class="sy0">&lt;</span>document .<span class="me1">styleSheets</span>.<span class="me1">length</span><span class="sy0">;</span>i<span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
		document.<span class="me1">styleSheets</span>.<span class="kw1">item</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span>.<span class="me1">disabled</span><span class="sy0">=</span><span class="kw2">true</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
	el <span class="sy0">=</span> document.<span class="me1">getElementsByTagName</span><span class="br0">&#40;</span><span class="st0">'*'</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="kw1">for</span> <span class="br0">&#40;</span> i<span class="sy0">=</span><span class="nu0">0</span><span class="sy0">;</span> i<span class="sy0">&lt;</span>el.<span class="me1">length</span><span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
		el<span class="br0">&#91;</span>i<span class="br0">&#93;</span>.<span class="me1">style</span>.<span class="me1">cssText</span> <span class="sy0">=</span> <span class="st0">''</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	div <span class="sy0">=</span> document.<span class="me1">createElement</span><span class="br0">&#40;</span><span class="st0">'div'</span><span class="br0">&#41;</span><span class="sy0">;</span>
	div.<span class="me1">innerHTML</span> <span class="sy0">=</span> <span class="st0">'&lt;h1 style=&quot;font-size:18pt;&quot;&gt;Note: a version of Internet Explorer of 6 or lower has been detected.&lt;p&gt;Your browser cannot display this page properly. For compatibility, this page has been reduced to a low-graphics mode. To view this site the way it was intended, please upgrade Internet Explorer or &lt;a href=&quot;http://browsehappy.com/browsers/&quot;&gt;switch to another browser&lt;/a&gt;.&lt;/p&gt;'</span><span class="sy0">;</span>
	div.<span class="me1">style</span>.<span class="me1">cssText</span> <span class="sy0">=</span> <span class="st0">'color:black; background-color:yellow; border:5px solid black; padding:15px;'</span><span class="sy0">;</span>
	document.<span class="me1">body</span>.<span class="me1">insertBefore</span><span class="br0">&#40;</span>div<span class="sy0">,</span> document.<span class="me1">body</span>.<span class="me1">firstChild</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span><span class="sy0">;</span></pre></div></div>

<p>To use it, stash the file somewhere on your server. Then, add the following HTML to your header (edited to reflect the file location).</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span class="sc-1">&lt;!--[if lte IE 6]&gt;</span>
<span class="sc-1">	&lt;script src=&quot;path/to/IE6unstyled.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</span>
<span class="sc-1">&lt;![endif]--&gt;</span></pre></div></div>

<p>Please feel free use this and make any modifications as you see fit.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chromakode.com/2008/12/letting-ie6-down-easy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
