<?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>Code Couch &#187; HTML</title>
	<atom:link href="http://www.codecouch.com/tag/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codecouch.com</link>
	<description>The ramblings of two code monkeys</description>
	<lastBuildDate>Thu, 19 Nov 2009 15:47:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Problems with anchors and alpha transparency filters in IE6</title>
		<link>http://www.codecouch.com/2008/10/problems-with-anchors-and-alpha-transparency-filters-in-ie6/</link>
		<comments>http://www.codecouch.com/2008/10/problems-with-anchors-and-alpha-transparency-filters-in-ie6/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 06:29:40 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[Internet Explorer]]></category>

		<guid isPermaLink="false">http://www.codecouch.com/?p=195</guid>
		<description><![CDATA[If you use the Microsoft filter CSS property to allow support for an alpha transparent PNG on an element, any links directly within that element are not clickable (in Internet Explorer 6 only). The problem is explained and a solution put forward that will make your links clickable again.]]></description>
			<content:encoded><![CDATA[<p>You can use alpha transparent PNGs in IE6 as described in <a href="http://www.codecouch.com/2007/05/how-do-i-display-alpha-transparent-pngs-across-all-browsers/">How do I display alpha transparent PNGs across all browsers</a>. There is a problem with implementing this solution &#8211; in Internet Explorer 6 links are no longer clickable when they are contained within an element with an alpha transparency filter applied.</p>
<div class="seeThrough h2Pod "><div class="seeThroughTop"><span class="tl"></span><span class="tr"></span><span class="t"></span></div><div class="seeThroughMiddle"><span class="r"></span><span class="l"></span><span class="m"></span><div class="seeThroughContent">
	<h2>The problem</h2>
</div></div><div class="seeThroughBottom"><span class="bl"></span><span class="br"></span><span class="b"></span></div></div>

<p>Consider the following CSS and HTML code snippets that set up the problem with a link contained within a div that has an alpha transparency filter applied to it:</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="css" style="color: #000000;">&lt;style type=<span class="st0">&quot;text/css&quot;</span><span class="sy0">&gt;</span>
<span class="re1">.opaque</span> <span class="br0">&#123;</span> <span class="kw1">background</span><span class="sy0">:</span> <span class="kw2">url</span><span class="br0">&#40;</span><span class="re4">images/alphaTransparent<span class="re1">.png</span></span><span class="br0">&#41;</span> <span class="kw2">transparent</span> <span class="kw2">no-repeat</span> <span class="kw1">left</span> <span class="kw1">top</span><span class="sy0">;</span> <span class="br0">&#125;</span>
&lt;/style<span class="sy0">&gt;</span>
&lt;!--<span class="br0">&#91;</span>if IE <span class="nu0">6</span><span class="br0">&#93;</span><span class="sy0">&gt;</span>
&lt;style type=<span class="st0">&quot;text/css&quot;</span><span class="sy0">&gt;</span>
<span class="re1">.opaque</span> <span class="br0">&#123;</span>
	<span class="kw1">background-image</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
	filter<span class="sy0">:</span> progid<span class="re2">:DXImageTransform</span><span class="re1">.Microsoft</span><span class="re1">.AlphaImageLoader</span><span class="br0">&#40;</span>enabled=true,sizingMethod=<span class="kw2">crop</span>,src=images/alphaTransparent<span class="re1">.png</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&lt;/style<span class="sy0">&gt;</span>
&lt;!<span class="br0">&#91;</span>endif<span class="br0">&#93;</span>--<span class="sy0">&gt;</span></pre></div></div></div>


<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="html4strict" style="color: #000000;">...
<span class="sc2"><span class="kw2">&lt;div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;parent&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;opaque&quot;</span><span class="kw2">&gt;</span></span>
    <span class="sc2"><span class="kw2">&lt;span</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;child&quot;</span><span class="kw2">&gt;</span></span>Lorem <span class="sc2"><span class="kw2">&lt;a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;http://www.codecouch.com&quot;</span><span class="kw2">&gt;</span></span>ipsum<span class="sc2"><span class="kw2">&lt;/a&gt;</span></span> dolor.<span class="sc2"><span class="kw2">&lt;/span&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;/div&gt;</span></span>
...</pre></div></div></div>

<p>The parent element has a class <b>opaque</b> applied to it which puts an image on the background of the element. In Internet Explorer 6 only, the background image is removed and the proprietary filter property is used. The link inside the child span is no longer clickable in Internet Explorer 6.</p>
<div class="seeThrough h2Pod "><div class="seeThroughTop"><span class="tl"></span><span class="tr"></span><span class="t"></span></div><div class="seeThroughMiddle"><span class="r"></span><span class="l"></span><span class="m"></span><div class="seeThroughContent">
	<h2>The solution</h2>
</div></div><div class="seeThroughBottom"><span class="bl"></span><span class="br"></span><span class="b"></span></div></div>

<p>Make sure the parent element (the element with the filter applied to it) doesn&#8217;t have the position property set on it, and the child element (the element with the link in it) has to have relative position.</p>
<p>The following addition to the above code will make the link clickable:</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="css" style="color: #000000;">&lt;!--<span class="br0">&#91;</span>if IE <span class="nu0">6</span><span class="br0">&#93;</span><span class="sy0">&gt;</span>
&lt;style type=<span class="st0">&quot;text/css&quot;</span><span class="sy0">&gt;</span>
<span class="re0">#child</span> <span class="br0">&#123;</span> <span class="kw1">position</span><span class="sy0">:</span> <span class="kw2">relative</span><span class="sy0">;</span> <span class="br0">&#125;</span>
&lt;/style<span class="sy0">&gt;</span>
&lt;!<span class="br0">&#91;</span>endif<span class="br0">&#93;</span>--<span class="sy0">&gt;</span></pre></div></div></div>

<p>Since it only has to apply for Internet Explorer 6, the &#8220;fix&#8221; can be enclosed within the <a href="http://www.codecouch.com/2007/04/how-to-target-specific-ie-browsers-using-just-html/">conditional comment</a> that targets just that browser. This doesn&#8217;t require any javascript to work (unlike <a href="http://bjorkoy.com/past/2007/4/8/the_easiest_way_to_png/">other solutions</a> that have been posted) and degrades properly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codecouch.com/2008/10/problems-with-anchors-and-alpha-transparency-filters-in-ie6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling cross-site scripting XSS via an iframe</title>
		<link>http://www.codecouch.com/2008/10/cross-site-scripting-xss-using-iframes/</link>
		<comments>http://www.codecouch.com/2008/10/cross-site-scripting-xss-using-iframes/#comments</comments>
		<pubDate>Sun, 19 Oct 2008 12:24:41 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Iframe]]></category>
		<category><![CDATA[XSS]]></category>

		<guid isPermaLink="false">http://www.codecouch.com/?p=173</guid>
		<description><![CDATA[Communication from an iframe that has content from a domain other than the one the iframe is contained within is a constant source of frustration - as browsers prevent this kind of activity due to built-in security policies. Here is a technique to perform cross-site scripting (XSS) in just such an environment with example code and a real-world example.]]></description>
			<content:encoded><![CDATA[<p>The scenario is relatively common &#8211; you have a page that contains an iframe pointing to some content hosted on another domain. Nothing wrong with this &#8211; iframes were designed with this in mind! The following diagram shows the sort of setup we are talking about.</p>
<p><img class="size-full wp-image-176" title="Iframed content diagram" src="http://www.codecouch.com/wp-content/uploads/2008/10/xssdiagraminitial.gif" alt="Diagram showing an iframe within a web page" width="394" height="186" /></p>
<p>Now you want to click a link within the iframe content and have that perform some action on the parent page (maybe you want to submit a form on the parent page, maybe you want to adjust the height of the iframe on the parent page). And you start getting frustrated because the browser won&#8217;t let you access all your javascript functions/properties on another domain.</p>
<p>Communication from an iframe that has content from a domain other than the one the iframe is contained within is a constant source of frustration &#8211; as browsers prevent this kind of activity due to built-in security policies. The solution is actually relatively painless requiring the addition of an iframe (see the following diagram).</p>
<p><img class="size-full wp-image-172" title="XSS Diagram" src="http://www.codecouch.com/wp-content/uploads/2008/10/xssdiagram.gif" alt="Diagram showing page structure for XSS via an iframe" width="394" height="186" /></p>
<div class="seeThrough h2Pod "><div class="seeThroughTop"><span class="tl"></span><span class="tr"></span><span class="t"></span></div><div class="seeThroughMiddle"><span class="r"></span><span class="l"></span><span class="m"></span><div class="seeThroughContent">
	<h2>Real world example</h2>
</div></div><div class="seeThroughBottom"><span class="bl"></span><span class="br"></span><span class="b"></span></div></div>

<p>You can see a working example of this over at <a href="http://movies.sky.com/cinema-finder" title="Sky Movies cinema finder page">Sky Movies</a> where the iframe is resized as the content within the iframe changes. This is being controlled from within the iframe.</p>
<p>Why do we need to implement a solution like this in the first place?</p>
<p>Because whilst the main page at movies.sky.com can set the height of the iframe, it cannot get the height of the iframe content&#8230; and the iframe document can get it&#8217;s height but it can&#8217;t set the height of it&#8217;s enclosing iframe.</p>
<div class="seeThrough h2Pod "><div class="seeThroughTop"><span class="tl"></span><span class="tr"></span><span class="t"></span></div><div class="seeThroughMiddle"><span class="r"></span><span class="l"></span><span class="m"></span><div class="seeThroughContent">
	<h2>An explaination of each component of the solution</h2>
</div></div><div class="seeThroughBottom"><span class="bl"></span><span class="br"></span><span class="b"></span></div></div>

<p>Using the following example pages, we can create a demonstration of this technique. Following is the source of the main page (marked as [1] in the figure above) which contains the iframe and the function that will be used to resize the iframe.</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="html4strict" style="color: #000000;"><span class="sc2"><span class="kw2">&lt;html&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;head&gt;</span></span>
	<span class="sc2"><span class="kw2">&lt;title&gt;</span></span>Page hosted on example.com<span class="sc2"><span class="kw2">&lt;/title&gt;</span></span>
	<span class="sc2"><span class="kw2">&lt;script</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span><span class="kw2">&gt;</span></span>
	function resizeIframeHeight(nHeight) {
		var iframe = document.getElementById('mainIframe');
		iframe.setAttribute('height', nHeight);
	}
	<span class="sc2"><span class="kw2">&lt;/script&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;/head&gt;</span></span>
&nbsp;
<span class="sc2"><span class="kw2">&lt;body&gt;</span></span>
	<span class="sc2"><span class="kw2">&lt;h1&gt;</span></span>This page is hosted on the example.com domain<span class="sc2"><span class="kw2">&lt;/h1&gt;</span></span>
	<span class="sc2"><span class="kw2">&lt;p&gt;</span></span>The iframe below is hosted on the example.org domain<span class="sc2"><span class="kw2">&lt;/p&gt;</span></span>
	<span class="sc2"><span class="kw2">&lt;iframe</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;mainIframe&quot;</span> <span class="kw3">width</span><span class="sy0">=</span><span class="st0">&quot;400&quot;</span> <span class="kw3">height</span><span class="sy0">=</span><span class="st0">&quot;200&quot;</span> <span class="kw3">src</span><span class="sy0">=</span><span class="st0">&quot;http://example.org/iframedDocument.html&quot;</span><span class="kw2">&gt;</span></span>Iframes not supported.<span class="sc2"><span class="kw2">&lt;/iframe&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;/body&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;/html&gt;</span></span></pre></div></div></div>

<p>Following is the source of the iframe page (marked as [2] in the figure above) which contains the extra iframe and some javascript that allows this technique to work.</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="html4strict" style="color: #000000;"><span class="sc2"><span class="kw2">&lt;html&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;head&gt;</span></span>
	<span class="sc2"><span class="kw2">&lt;title&gt;</span></span>Page hosted on example.org<span class="sc2"><span class="kw2">&lt;/title&gt;</span></span>
	<span class="sc2"><span class="kw2">&lt;script</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span><span class="kw2">&gt;</span></span>
	function updateIframeHeight() {
		var iframe = document.getElementById('hiddenIframe');
		var newHeight = parseInt(document.body.offsetHeight,10) + 10;
		iframe.src = 'http://example.com/xssEnabler.html?height=' + newHeight;
	}
	<span class="sc2"><span class="kw2">&lt;/script&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;/head&gt;</span></span>
&nbsp;
<span class="sc2"><span class="kw2">&lt;body</span> <span class="kw3">onload</span><span class="sy0">=</span><span class="st0">&quot;updateIframeHeight()&quot;</span><span class="kw2">&gt;</span></span>
	<span class="sc2"><span class="kw2">&lt;h1&gt;</span></span>This page is hosted on the example.org domain<span class="sc2"><span class="kw2">&lt;/h1&gt;</span></span>
	<span class="sc2"><span class="kw2">&lt;p&gt;</span></span>The iframe below is hosted on the example.com domain (and be styled to be hidden)<span class="sc2"><span class="kw2">&lt;/p&gt;</span></span>
	<span class="sc2"><span class="kw2">&lt;iframe</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;hiddenIframe&quot;</span> <span class="kw3">width</span><span class="sy0">=</span><span class="st0">&quot;100&quot;</span> <span class="kw3">height</span><span class="sy0">=</span><span class="st0">&quot;100&quot;</span> <span class="kw3">src</span><span class="sy0">=</span><span class="st0">&quot;http://example.com/xssEnabler.html&quot;</span><span class="kw2">&gt;</span></span>Iframes not supported.<span class="sc2"><span class="kw2">&lt;/iframe&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;/body&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;/html&gt;</span></span></pre></div></div></div>

<p>The final source file resides on the original domain (marked as [3] in the figure above) and contains some javascript to strip out the height parameter and then pass this on to the function on the main page that resizes the iframe. It is referred to in the code above, as the content of the file at http://example.org/xssEnabler.html &#8211; and whilst it is saved as a .html file, it contains just the code you see below.</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="javascript" style="color: #000000;"><span class="sy0">&lt;</span>script type<span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span><span class="sy0">&gt;</span>
	<span class="kw2">function</span> getFirstParamFromLocation<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
		<span class="kw2">var</span> pair <span class="sy0">=</span> window.<span class="me1">location</span>.<span class="me1">search</span>.<span class="me1">substring</span><span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="kw2">var</span> parts <span class="sy0">=</span> pair.<span class="me1">split</span><span class="br0">&#40;</span><span class="st0">'='</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="kw1">return</span> parts<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
	<span class="kw2">var</span> nHeight <span class="sy0">=</span> getFirstParamFromLocation<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="kw1">try</span> <span class="br0">&#123;</span>
		window.<span class="me1">top</span>.<span class="me1">resizeIframeHeight</span><span class="br0">&#40;</span>height<span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="br0">&#125;</span> <span class="kw1">catch</span><span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span><span class="br0">&#125;</span><span class="sy0">;</span>
<span class="sy0">&lt;/</span>script<span class="sy0">&gt;</span></pre></div></div></div>

<p>Obviously you would not be using example.com and example.org for your solution, they are used merely to identify the different domains you would use for each file.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codecouch.com/2008/10/cross-site-scripting-xss-using-iframes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to target specific IE browsers using just HTML?</title>
		<link>http://www.codecouch.com/2007/04/how-to-target-specific-ie-browsers-using-just-html/</link>
		<comments>http://www.codecouch.com/2007/04/how-to-target-specific-ie-browsers-using-just-html/#comments</comments>
		<pubDate>Wed, 18 Apr 2007 10:08:01 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[HTML/XHTML]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.codecouch.com/?p=110</guid>
		<description><![CDATA[Conditional comments are totally valid markup (for HTML as well as XHTML doctypes) that cause IE browsers running in Windows to parse the contents of the commented markup.]]></description>
			<content:encoded><![CDATA[<p>Many people were introduced to <a href="http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp">conditional comments</a> with the introduction of IE7 and their grass-roots <a href="http://blogs.msdn.com/ie/archive/2005/10/12/480242.aspx">call to action</a> to stop using “CSS Hacks” to target specific IE browser versions.</p>
<p>Conditional comments are totally valid markup (for HTML as well as XHTML doctypes) that cause IE browsers running in Windows (the old Mac versions of IE ignored them completely) to parse the contents of the commented markup.</p>
<p>The following code shows how a conditional comment can be used to match “all versions of IE less than version 7″ and include an extra css file and an extra div in the content of the page:</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="html4strict" style="color: #000000;"><span class="sc2"><span class="kw2">&lt;html&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;head&gt;</span></span>
  <span class="sc2"><span class="kw2">&lt;link</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;default.css&quot;</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/css&quot;</span> <span class="kw3">rel</span><span class="sy0">=</span><span class="st0">&quot;stylesheet&quot;</span> <span class="sy0">/</span><span class="kw2">&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;</span>!––<span class="br0">&#91;</span>if lt IE <span class="nu0">7</span><span class="br0">&#93;</span><span class="kw2">&gt;</span></span>
  <span class="sc2"><span class="kw2">&lt;link</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;iexplore.css&quot;</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/css&quot;</span> <span class="kw3">rel</span><span class="sy0">=</span><span class="st0">&quot;stylesheet&quot;</span> <span class="sy0">/</span><span class="kw2">&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;</span>!<span class="br0">&#91;</span>endif<span class="br0">&#93;</span>––<span class="kw2">&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;/head&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;body&gt;</span></span>
  <span class="sc2"><span class="kw2">&lt;h1&gt;</span></span>Testing<span class="sc2"><span class="kw2">&lt;/h1&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;</span>!––<span class="br0">&#91;</span>if lt IE <span class="nu0">7</span><span class="br0">&#93;</span><span class="kw2">&gt;</span></span>
  <span class="sc2"><span class="kw2">&lt;div&gt;</span></span>I’m an old IE running in Windows<span class="sc2"><span class="kw2">&lt;/div&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;</span>!<span class="br0">&#91;</span>endif<span class="br0">&#93;</span>––<span class="kw2">&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;/body&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;/html&gt;</span></span></pre></div></div></div>

<p>Because of the start HTML comment code (<code>&lt;!--</code>), everything until the close HTML comment code (<code>--&gt;</code>) is treated as a comment for non matching IE Windows browsers.</p>
<p>The code that is actually rendered by the browser is different when viewed in IE Windows browsers older than IE7 and any other browser:</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="html4strict" style="color: #000000;"><span class="sc2"><span class="kw2">&lt;html&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;head&gt;</span></span>
  <span class="sc2"><span class="kw2">&lt;link</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;default.css&quot;</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/css&quot;</span> <span class="kw3">rel</span><span class="sy0">=</span><span class="st0">&quot;stylesheet&quot;</span> <span class="sy0">/</span><span class="kw2">&gt;</span></span>
  <span class="sc2"><span class="kw2">&lt;link</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;iexplore.css&quot;</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/css&quot;</span> <span class="kw3">rel</span><span class="sy0">=</span><span class="st0">&quot;stylesheet&quot;</span> <span class="sy0">/</span><span class="kw2">&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;/head&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;body&gt;</span></span>
  <span class="sc2"><span class="kw2">&lt;h1&gt;</span></span>Testing<span class="sc2"><span class="kw2">&lt;/h1&gt;</span></span>
  <span class="sc2"><span class="kw2">&lt;div&gt;</span></span>I'm an old IE running in Windows<span class="sc2"><span class="kw2">&lt;/div&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;/body&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;/html&gt;</span></span></pre></div></div></div>

<p>This is the code that is rendered in other browsers:</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="html4strict" style="color: #000000;"><span class="sc2"><span class="kw2">&lt;html&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;head&gt;</span></span>
  <span class="sc2"><span class="kw2">&lt;link</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;default.css&quot;</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/css&quot;</span> <span class="kw3">rel</span><span class="sy0">=</span><span class="st0">&quot;stylesheet&quot;</span> <span class="sy0">/</span><span class="kw2">&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;/head&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;body&gt;</span></span>
  <span class="sc2"><span class="kw2">&lt;h1&gt;</span></span>Testing<span class="sc2"><span class="kw2">&lt;/h1&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;/body&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;/html&gt;</span></span></pre></div></div></div>

<p>You might choose to use this to set some variables on the page for javascript to use &#8211; without having to worry about user agent detection issues and spoofing browsers (remember that this will not work for the old IE Mac browsers &#8211; only Windows):</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="html4strict" style="color: #000000;"><span class="sc2"><span class="kw2">&lt;script</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span><span class="kw2">&gt;</span></span>
  var isIE=isIE5=isIE6=isIE7=false;
<span class="sc2"><span class="kw2">&lt;/script&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;</span>!––<span class="br0">&#91;</span>if IE<span class="br0">&#93;</span><span class="kw2">&gt;</span></span>
  <span class="sc2"><span class="kw2">&lt;script</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span><span class="kw2">&gt;</span></span>
    isIE=true;
  <span class="sc2"><span class="kw2">&lt;/script&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;</span>!<span class="br0">&#91;</span>endif<span class="br0">&#93;</span>––<span class="kw2">&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;</span>!––<span class="br0">&#91;</span>if IE <span class="nu0">7</span><span class="br0">&#93;</span><span class="kw2">&gt;</span></span>
  <span class="sc2"><span class="kw2">&lt;script</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span><span class="kw2">&gt;</span></span>
    isIE7=true;
  <span class="sc2"><span class="kw2">&lt;/script&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;</span>!<span class="br0">&#91;</span>endif<span class="br0">&#93;</span>––<span class="kw2">&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;</span>!––<span class="br0">&#91;</span>if IE <span class="nu0">6</span><span class="br0">&#93;</span><span class="kw2">&gt;</span></span>
  <span class="sc2"><span class="kw2">&lt;script</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span><span class="kw2">&gt;</span></span>
    isIE6=true;
  <span class="sc2"><span class="kw2">&lt;/script&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;</span>!<span class="br0">&#91;</span>endif<span class="br0">&#93;</span>––<span class="kw2">&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;</span>!––<span class="br0">&#91;</span>if IE <span class="nu0">5</span><span class="br0">&#93;</span><span class="kw2">&gt;</span></span>
  <span class="sc2"><span class="kw2">&lt;script</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span><span class="kw2">&gt;</span></span>
    isIE5=true;
  <span class="sc2"><span class="kw2">&lt;/script&gt;</span></span>
<span class="sc2"><span class="kw2">&lt;</span>!<span class="br0">&#91;</span>endif<span class="br0">&#93;</span>––<span class="kw2">&gt;</span></span></pre></div></div></div>

<p>Be sure to check out the difference between <b>down-level hidden</b> (which is what I have used all the examples in this FAQ) and <b>down-level revealed</b> at the <a href="http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp">MSDN conditional comments</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codecouch.com/2007/04/how-to-target-specific-ie-browsers-using-just-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
