Blog of Tom Phan, containing my thoughts, comments and questions. RSS Feed


Response.Redirect and the (#) anchor in IE6

In IE6, Response.Redirect does not work properly when you specify an (#) anchor as a bookmark in a string you pass to Response.Redirect().  In one of our project, we used Response.Redirect, specify an ulr and then append the (#) anchor to bookmark where we want the link to navigate to on the targeted page. This works fine in IE 7 and Firefox, but this does not work in IE6. The work around for this is simply appending a meaningless QueryString value after your real request and before the (#) anchor or just add an "&" right before the (#)anchor.

Example:

Response.Redirect("Http://foo.com/detail.aspx?itemid=1#itemdetail);

What you expect to happen is that the link should navigate you to an anchor tag with the name "itemdetail" somewhere on the detail page for itemid=1.

<a name="itemdetail">some details…</a>

This is true in IE 7 and Firefox, but not in IE 6.   In IE6 you can navigate to this anchor if you append it with an "&":

 Response.Redirect("Http://foo.com/detail.aspx?itemid=1&#itemdetail); 

 
Posted by Tom Phan | 6 Comments | Trackback Url | Bookmark with:        
Tags:

Links to this Post

Comments

Thursday, 17 Jan 2008 05:02 by Re: Response.Redirect and the (#) anchor in IE6
Thanks very much for posting, I have been scratching me head about this for a long time, don't you just love IE6!!

Wednesday, 11 Jun 2008 01:51 by Re: Response.Redirect and the (#) anchor in IE6
im using dreamweaver...it seems that its not working. well thats because i dont know where to put this: Response.Redirect("Http://foo.com/detail.aspx?itemid=1&#itemdetail); i use: <a href="component_1-1.aspx#1-1">stuff</a> and: <a name="1-1" id="1-1"></a> on the other page. it works well on IE& and Firefox. but not in IE. i tried: <a href="component_1-1.aspx&#1-1">stuff</a> but its not working. can anybody help me? thanks

Wednesday, 11 Jun 2008 01:52 by Re: Response.Redirect and the (#) anchor in IE6
i meant to say it works well in IE7 and firefox but not in IE6

Thursday, 7 May 2009 03:02 by cause only redirecting by ASP.Net
Why it cause when redirecting the user to the page using Reposen.Redirect?

Wednesday, 8 Jul 2009 09:34 by Does it with PHP as well
I encountered this problem redirecting with PHP as well. Yet another reason to burn IE6 to the ground.

Name:
URL:
Email:
Comments:

CAPTCHA Image Validation