opera redirect not working

For some reason Opera cannot handle having an anchor in a URL to redirect. I wrote a simple test with a form that has a single hidden field containing a URL with an anchor. When submitted, the form sends the hidden value to be used in a call to the header function, which is supposed to redirect the user to the new URL. It works fine in the other browsers I’ve tested, but for some reason in Opera it just sits waiting forever (or at least several minutes. I haven’t been willing to wait any longer)

Maybe there’s a way to make it work, but I’ve tried escaping the # sign with an HTML character entity, but I got the same behavior. If anyone has any ideas about why Opera doesn’t work with the anchor in the URL I’d be very interested in hearing them.

Here’s the code I used for the test:

<?php
$url = $_POST[ 'url' ];
header( "Location: $url" );
?>
<html>
<form method="post" action="test.php">
<input type="hidden" name="url" value="<?php echo $_SERVER[ 'PHP_SELF' ];
?>#bottom">
<input type="submit" value="Submit">
</form>

<div style="margin-top:500px;margin-bottom:1000px">
<a name="bottom"></a>
<h1>This is the bottom</h1>
</div>

</html>




  1. You may be interested in this thread where I’ve stumbled across a weird,(but not very elegant) fix for this:
    http://my.opera.com/forums/showthread.php?s=&postid=817237#post817237

    Hasta later,
    kamm…

      » Comment by kamm on January 27, 2005 @ 1:45 pm
  2. Thanks for letting me know. I’m glad to see I wasn’t the only one seeing that problem but it’s too bad no one has found a cleaner solution.

      » Comment by dan on January 27, 2005 @ 2:38 pm
  3. I commented on this over at http://bzabza.com/php/94/ basically Opera sees that it is the same page just with an anchor so it only tries to goto that anchor in the current page. Now adding a GET parameter to the redirect will force it to reload the page but it has the unfortunate side effect of leaving any forms filled in with the old data even employing every anti cache trick in the book.

      » Comment by Jason Bainbriudge on August 31, 2005 @ 11:04 pm


Post a comment










Number of readers
- home
comics
news links
other links

about me
blog archives
docs
entertainment
experiences
funny lists
humor
intellectual
interests
mefi
music
opinions
photos
web designs
tools
software
webmaster help

Sign up
Enter your email address to be notified of new posts



Search blog archives

Calendar
November 2004
S M T W T F S
« Oct   Dec »
 123456
78910111213
14151617181920
21222324252627
282930  







Random quote
(View all quotes)
"The key to everything is patience. You get the chicken by hatching the egg, not by smashing it."










Licensed under Creative Commons
(?) Choose theme:  X X X X X X


W3CCSS
Loaded in 0.0509 seconds