IE 6 named anchor and CFlocation error and workaround

A co-worker (Matt) and I stumbled on to this issue for a second time this AM while the boss was giving a demo for the client of a new feature added to the client's site. I am fairly sure that I remember seeing this before and had almost entirely forgotten about it. I figureit is time to blog about and share what we found and maybe I can remember it next time.

We have a page the does some stuff then cflocates off to another page with a url.ID var and a named anchor. This page would always throw an error when you use IE, but if you simply hit reload on IE the error would go away. The error would be a result of the url.ID var and the named anchor getting mashed together during the CFloaction.

This issue seems to only show up when IE 6, cflocation, named anchors and a query string value are used together.

 Here is an example chunk of code. Only if you use IE do you see the problem.

<cfif not isdefined('url.id')>
    <cflocation URL="#GetFileFromPath(cgi.script_name)#?id=1234##top" addtoken="false">
<cfelse>
    <cfdump var="#url#">
</cfif>

So far, the only workaround I have found is to use a & (amper sign) just before the named anchor.

<cflocation URL="#GetFileFromPath(cgi.script_name)#?id=1234&##top" addtoken="false">

 

After I started looking into this problem I see Ray Camden wrote about the issue about a year ago.
http://ray.camdenfamily.com/index.cfm/2005/10/8/IIS6-Bug-with-CFLOCATION

Comments
Raymond Camden's Gravatar Yep, I never did find a good reason why. If you do, let me know.
# Posted By Raymond Camden | 8/15/06 1:56 PM
Need For News's Gravatar Needfornews.com New great news aggregator. With it You won't need anything else to read news.
http://needfornews.com/top_search.php
http://vidslib.com/
# Posted By Need For News | 3/27/08 4:10 AM
# Posted By Rednek | 4/1/08 6:14 AM
# Posted By News Aggregator | 4/2/08 7:59 AM
watch divx film  online's Gravatar http://topvideodvd.com
Thousands of hot movies that you dare to watch. Movies are playable on various devices including iPod, PDA (HandHelds), PC, DVD & DivX players. Lowest prices on the web ever. Start downloading movies from $1.99 only! Absolutely no limits. You can download as much as you want with incredibly high speeds. No additional software required. Click on a link, download a movie and watch it on your favourite player.
# Posted By watch divx film online | 4/14/08 3:02 AM
infomediaguide's Gravatar Thanks for posting
interesting site
http://infomediaguide.com
# Posted By infomediaguide | 5/1/08 5:36 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.001. Contact Blog Owner