<?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; Internet Explorer</title>
	<atom:link href="http://www.codecouch.com/tag/internet-explorer/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codecouch.com</link>
	<description>The ramblings of two code monkeys</description>
	<lastBuildDate>Mon, 09 Jan 2012 21:11:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How to stop Internet Explorer from caching AJAX requests</title>
		<link>http://www.codecouch.com/2009/01/how-to-stop-internet-explorer-from-caching-ajax-requests/</link>
		<comments>http://www.codecouch.com/2009/01/how-to-stop-internet-explorer-from-caching-ajax-requests/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 13:53:34 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[IE7]]></category>
		<category><![CDATA[Internet Explorer]]></category>

		<guid isPermaLink="false">http://www.codecouch.com/?p=250</guid>
		<description><![CDATA[There are several ways to solve the problem of browsers caching AJAX requests. You can use a 'cache buster' parameter, or you can set the response headers server-side. This article discusses these two options.]]></description>
			<content:encoded><![CDATA[<p>I recently had to revisit the issue of IE&#8217;s default cache settings causing problems when making AJAX requests. Out-of-the-box, the cache setting is &#8216;Automatically&#8217;, where pages are only fetched from the server if the cached content is from an earlier day, old or from an earlier session.</p>
<p>This can be a nightmare to deal with, as you cannot ask all users of a web site to change their browser settings.</p>
<p>One workaround is to use a &#8216;cache buster&#8217; parameter in your GET request. Something like this:</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="javascript"><span class="kw2">var</span> urlToFetch <span class="sy0">=</span> <span class="st0">'whatever.php?randNum='</span> <span class="sy0">+</span> <span class="kw2">new</span> Date<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getTime</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div></div>

<p>This works very well, but can have drawbacks, depending on your server setup. For example, if your application server sits behind a caching layer, you wouldn&#8217;t want the URL to be different every time for idempotent requests, as the cached version would never get used, and so your application server would get a direct hit every time.</p>
<p>One way around this without using to parameters is to set the &#8216;Cache-Control&#8217; response header to direct the browser how to cache the response.</p>
<p>The &#8216;Cache-Control&#8217; header can have various values, one of which is &#8216;no-cache&#8217;. This tells the browser that it should not cache the response, so the next time the same URL is requested, new content will always be sent (as there is no previous version in the browser&#8217;s cache).</p>
<p>This is how we do it using Groovy:</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="javascript">response.<span class="me1">addHeader</span> <span class="st0">&quot;Cache-Control&quot;</span><span class="sy0">,</span> <span class="st0">&quot;max-age=0,no-cache,no-store&quot;</span></pre></div></div></div>

<p>So really, which method you use boils down to this: If you know that the cache buster will have a performance hit on your setup, then don&#8217;t use it, otherwise use whichever method you prefer.</p>
<p>Also, as a developer, I can highly recommend changing your IE cache settings to &#8216;Every visit to the page&#8217;.</p>
		<div  class="headingPod headingLevel2 headingLevel2Pink">
			<div class="img">
				<div class="verticalCentreOuter">
					<div class="verticalCentreMiddle">
						<div class="verticalCentreInner">
							<h2>Update 10/02/2008</h2>
						</div>
					</div>
				</div>
			</div>
		</div>
<p>We&#8217;re finding that with some of our automated testing, IE 7 still caches the odd file now and then. To get around this, we have modified our &#8216;Cache-Control&#8217; header to include two non-standard properties, &#8216;post-check&#8217; and &#8216;pre-check&#8217;, and added an &#8216;Expires&#8217; header as well:</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="javascript">response.<span class="me1">addHeader</span> <span class="st0">&quot;Cache-Control&quot;</span><span class="sy0">,</span> <span class="st0">&quot;max-age=0,no-cache,no-store,post-check=0,pre-check=0&quot;</span><span class="sy0">;</span>
response.<span class="me1">addHeader</span> <span class="st0">&quot;Expires&quot;</span><span class="sy0">,</span> <span class="st0">&quot;Mon, 26 Jul 1997 05:00:00 GMT&quot;</span></pre></div></div></div>

<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=How+to+stop+Internet+Explorer+from+caching+AJAX+requests+http%3A%2F%2Fis.gd%2FZzSteJ" title="Post to Twitter"><img class="nothumb" src="http://www.codecouch.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-big4.png" alt="Post to Twitter" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.codecouch.com/2009/01/how-to-stop-internet-explorer-from-caching-ajax-requests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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="headingPod headingLevel2 headingLevel2Orange">
			<div class="img">
				<div class="verticalCentreOuter">
					<div class="verticalCentreMiddle">
						<div class="verticalCentreInner">
							<h2>The problem</h2>
						</div>
					</div>
				</div>
			</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">&lt;style type<span class="sy0">=</span><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="co2">images/alphaTransparent.png</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="sy0">=</span><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>.AlphaImageLoader<span class="br0">&#40;</span>enabled<span class="sy0">=</span>true<span class="sy0">,</span>sizingMethod<span class="sy0">=</span><span class="kw2">crop</span><span class="sy0">,</span>src<span class="sy0">=</span>images/alphaTransparent.png<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">...
<span class="sc2">&lt;<span class="kw2">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>&gt;</span>
    <span class="sc2">&lt;<span class="kw2">span</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;child&quot;</span>&gt;</span>Lorem <span class="sc2">&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;http://www.codecouch.com&quot;</span>&gt;</span>ipsum<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;</span> dolor.<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">span</span>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</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="headingPod headingLevel2 headingLevel2Pink">
			<div class="img">
				<div class="verticalCentreOuter">
					<div class="verticalCentreMiddle">
						<div class="verticalCentreInner">
							<h2>The solution</h2>
						</div>
					</div>
				</div>
			</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">&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="sy0">=</span><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>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Problems+with+anchors+and+alpha+transparency+filters+in+IE6+http%3A%2F%2Fis.gd%2FpJHlLw" title="Post to Twitter"><img class="nothumb" src="http://www.codecouch.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-big4.png" alt="Post to Twitter" /></a></p></div>]]></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>
	</channel>
</rss>

