Connecting Tech Pros Worldwide Help | Site Map

redirect with Anchor Tag in IE

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 09:58 AM
AlanFoust@gmail.com
Guest
 
Posts: n/a
Default redirect with Anchor Tag in IE

The following PHP code snippet works in Firefox and Opera but NOT
Internet Explorer (I'm using IE v 6.0.2xxx)


$url =
"http://www.theredirectsite.com/testpage.php?IDa=162&IDb=19909#AT2";
header("Location: " . $url); /* Redirect browser */
exit;

The Anchor Tag: "#AT2" generates a 505 error in Explorer. When the
Anchor Tag [#AT2] is removed from the URL everything works fine.
Any thoughts on a workaround?


  #2  
Old July 17th, 2005, 09:58 AM
musicinmyhead
Guest
 
Posts: n/a
Default Re: redirect with Anchor Tag in IE

> The following PHP code snippet works in Firefox and Opera but NOT[color=blue]
> Internet Explorer (I'm using IE v 6.0.2xxx)
>
> $url =
> "http://www.theredirectsite.com/testpage.php?IDa=162&IDb=19909#AT2";
> header("Location: " . $url); /* Redirect browser */
> exit;
>
> The Anchor Tag: "#AT2" generates a 505 error in Explorer. When the
> Anchor Tag [#AT2] is removed from the URL everything works fine.
> Any thoughts on a workaround?[/color]

That's strange. Using your exact code there (simply changing the url),
it worked perfectly fine for me in IE. Maybe try replacing the # sign
with %23 instead, though I doubt that will fix the problem. I don't see
why it wouldn't work though.

  #3  
Old July 17th, 2005, 09:58 AM
AlanFoust@gmail.com
Guest
 
Posts: n/a
Default Re: redirect with Anchor Tag in IE

Thanks for your comments. Here's the exact URL although I don't think
that makes a difference....

<?
// next line doesn't work in IE (but works in Firefox and Opera)
$url =
"http://www.giuseppeverdi.it/Inglese/page.asp?IDCategoria=162&IDSezione=581&ID=19909#AT 2";
// when uncommented the next line works in IE
//$url =
"http://www.giuseppeverdi.it/Inglese/page.asp?IDCategoria=162&IDSezione=581&ID=19909";
header("Location: " . $url); /* Redirect browser */
exit;
?>

BTW: It generates a 500 error in IE not 505.

  #4  
Old July 17th, 2005, 09:58 AM
AlanFoust@gmail.com
Guest
 
Posts: n/a
Default Re: redirect with Anchor Tag in IE

Thanks for your comments. Here's the exact URL although I don't think
that makes a difference....

<?
// next line doesn't work in IE (but works in Firefox and Opera)
$url =
"http://www.giuseppeverdi.it/Inglese/page.asp?IDCategoria=162&IDSezione=581&ID=19909#AT 2";
// when uncommented the next line works in IE
//$url =
"http://www.giuseppeverdi.it/Inglese/page.asp?IDCategoria=162&IDSezione=581&ID=19909";
header("Location: " . $url); /* Redirect browser */
exit;
?>

BTW: It generates a 500 error in IE not 505.

  #5  
Old July 17th, 2005, 09:59 AM
John Dunlop
Guest
 
Posts: n/a
Default Re: redirect with Anchor Tag in IE

An anonymous being wrote:
[color=blue]
> $url =
> "http://www.theredirectsite.com/testpage.php?IDa=162&IDb=19909#AT2";
> header("Location: " . $url); /* Redirect browser */
> exit;
>
> The Anchor Tag: "#AT2" generates a 50[0] error in Explorer. When the
> Anchor Tag [#AT2] is removed from the URL everything works fine.[/color]

I can't reproduce your problem with my Internet Explorer web
browser (version 6.0.2600.0000IC, Windows 98). Could you
provide a URI to a test case? The error is maybe peculiar
to your server's response.

HTTP/1.1 does not, in fact, permit a fragment identifier as
part of the URI in a Location header. Its errata, however,
corrects this mistake; and I imagine the next version will
include the revision. But because browser developers
understand the spirit of the protocol, not just its exact
words, most browsers can handle such URIs.
[color=blue]
> Any thoughts on a workaround?[/color]

Not at this time; sorry.

--
Jock
  #6  
Old July 17th, 2005, 09:59 AM
AlanFoust@gmail.com
Guest
 
Posts: n/a
Default Re: redirect with Anchor Tag in IE

Jock,

This is the actual URL [the one with the Anchor Tag] in question:

<?
// next line doesn't work in IE (but works in Firefox and Opera)
$url =
"http://www.giuseppeverdi.it/Inglese/page.asp?IDCategoria=162&IDSezione=581&ID=19909#AT 2";
// when uncommented the next line works in IE
//$url =
"http://www.giuseppeverdi.it/Inglese/page.asp?IDCategoria=162&IDSezione=581&ID=19909";
header("Location: " . $url); /* Redirect browser */
exit;
?>

thanks....

  #7  
Old July 17th, 2005, 09:59 AM
John Dunlop
Guest
 
Posts: n/a
Default Re: redirect with Anchor Tag in IE

An anonymous being wrote:
[color=blue]
> This is the actual URL [the one with the Anchor Tag] in question:[/color]

[ ... ]

Sorry, I meant the original URI, the one from which you are
redirecting. My reason for asking is that another part of
the response might be causing the problem. I suspect that
it's just a quirk in your browser though.

--
Jock
  #8  
Old July 17th, 2005, 09:59 AM
AlanFoust@gmail.com
Guest
 
Posts: n/a
Default Re: redirect with Anchor Tag in IE

Jock,

Here's the URI:
http://www.allaboutopera.com/opera_r...opera_ndx=1358

The redirects in question are the "libretto" links -- Act 1, Act 2,
etc. Each of those links passes an Anchor Tag.
Thanks for your help.....

  #9  
Old July 17th, 2005, 10:00 AM
John Dunlop
Guest
 
Posts: n/a
Default Re: redirect with Anchor Tag in IE

An anonymous being wrote:
[color=blue]
> http://www.allaboutopera.com/opera_r...opera_ndx=1358
>
> The redirects in question are the "libretto" links -- Act 1, Act 2,
> etc.[/color]

I get an error with my IE too, but not if I key the address
in directly. Turn off friendly error messages (Tools >
Internet Options > Advanced) and you instead get some
Italian text, after which you can press refresh to retrieve
the page.

You could, of course, miss out the middle man: rather than
linking to the horrible-looking

http://www.allaboutopera.com/redir/i...rl=http%3A%2F%
2Fwww.giuseppeverdi.it%2FInglese%2Fpage.asp%3FIDCa tegoria%3D
162%26IDSezione%3D581%26ID%3D19909%23AT1

link to the not quite so horrible-looking

http://www.giuseppeverdi.it/Inglese/...DCategoria=162
&IDSezione=581&ID=19909#AT1

IE does handle #s in Location URIs though; you can try it
yourself. I don't know why this redirect is any different.
Since the problem seems to be specific to IE, and it's off-
topic here, I'd consult an IE newsgroup. (They have a
separate group for this because it's not worth including IE
in discussions of proper browsers.)

--
Jock
  #10  
Old October 12th, 2005, 02:45 AM
Newbie
 
Join Date: Oct 2005
Age: 34
Posts: 1
Default The ONLY possible fix if using PHP

Quote:
Originally Posted by AlanFoust@gmail.com
Jock,

Here's the URI:
http://www.allaboutopera.com/opera_r...opera_ndx=1358

The redirects in question are the "libretto" links -- Act 1, Act 2,
etc. Each of those links passes an Anchor Tag.
Thanks for your help.....
:eek: Unfortunately, when PHP takes the string argument in the header() function, it does not properly pass the '#' pound sign to the header. The best solution for this is to return a blank page (or a 'you are being redirected, click here if you don't go there) with a META redirect in the head of the returned document. i.e. HTTP-EQUIV=Refresh CONTENT=0;url_to_redirect_to

Passing a blank page shouldn't affect any processing in the page, especially if your script buffers the output.

-~Cheers~-
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.