473,414 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

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?

Jul 17 '05 #1
9 9806
> 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?


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.

Jul 17 '05 #2
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.

Jul 17 '05 #3
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.

Jul 17 '05 #4
An anonymous being wrote:
$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.
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.
Any thoughts on a workaround?


Not at this time; sorry.

--
Jock
Jul 17 '05 #5
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....

Jul 17 '05 #6
An anonymous being wrote:
This is the actual URL [the one with the Anchor Tag] in question:


[ ... ]

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
Jul 17 '05 #7
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.....

Jul 17 '05 #8
An anonymous being wrote:
http://www.allaboutopera.com/opera_r...opera_ndx=1358

The redirects in question are the "libretto" links -- Act 1, Act 2,
etc.


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
Jul 17 '05 #9
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~-
Oct 12 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Peroq | last post by:
Hi all, All of these fail : response.redirect("page.asp?Param=Param#Anchor") response.redirect("page.asp#Anchor?Param=Param") This one works fine : location.href =...
1
by: Rafael Leonhardt | last post by:
I know that smartnavigation works on formpost. But I can to do smartnavigation works when I redirect to same page than post the page. Example: Actual page is "mainpage.aspx?param=xx" In a...
3
by: david | last post by:
myIn the current web form page, I use Response.Redirect(fullURL) where fullURL = "ftp://myURL" to a FTP service (control by a button). But it does not work. What is wrong with it? Should it...
1
by: june | last post by:
I am using the following code to re-direct a page. Dim strfile As String = "http://S4" & Me.dgResults.DataKeys(e.Item.ItemIndex) Response.Redirect(Server.UrlPathEncode(strfile)) where...
3
by: gary | last post by:
Hi, I am trying to reference an anchor in a user control with a url. This worked in 1.1 but no longer works in 2.0. The ascx control is located in a "/include" folder If you have a...
3
by: Sean | last post by:
Basically how do I set "Target=_blank" on a url string and can it be used by any of the following Response.Redirect() Server.Transfer() PostBackURL on a link button. So far the ONLY way I...
1
by: comp.lang.php | last post by:
require_once("/users/ppowell/web/php_global_vars.php"); if ($_GET) { // INITIALIZE VARS $fileID = @fopen("$userPath/xml/redirect.xml", 'r'); $stuff = @fread($fileID,...
3
by: Joseph Gruber | last post by:
Hi all -- I have two questions. First, I'm adding a control to my form at runtime and the control/form seems to ignore the anchor property of the runtime control. Any idea how I can get a...
0
by: robbiesmith79 | last post by:
Here's a workaround that worked for me on a PC, Safari 3, FF 2, IE 7: Basically, you need an intermediary redirect page with a urlencode'd path. For example: AnyPage.php: $path =...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.