Thursday February 9, 2012 @ 06:16:44 GMT+10    ( Weather:  n/a )
Home » Weblog Archives

Powered byD's Bloggie
Weblog » Archive » 2005 » October » Day 09 » Opera and PHP header()
Browse by specific entry ...
 SVG - Scalable Vector GraphicsFF VII - Advent Children 

Last edited: Tue 2005-10-11 @ 01:56 , by DaRen 1 time(s)

Opera and PHP header() - 7:27 pm
Browser , Bug , PHP , Standards  -  poster 

It's pretty common in PHP where a header() function is used to redirect the user to a specify page.

[ Hide ]
[ Highlight ] [ Text ]
<?
header("Location: http://www.domain.com");
header("Refresh: 5; http://www.domain.com"); // Redirect after 5 secs
?>


The above code will work perfectly. However, given a URI http://www.domain.com/file01.php?do=something#anchorhere

[ Hide ]
[ Highlight ] [ Text ]
<?
// This won't work with Opera 7.54 or even earlier,
// or this never worked before in Opera up to 8.5
header("Location: http://www.domain.com/file01.php?do=something#anchorhere");
// No problem for this though
header("Refresh: 5; http://www.domain.com/file01.php?do=something#anchorhere");
// A method to overcome the problem in Opera
header("Refresh: 0; http://www.domain.com/file01.php?do=something#anchorhere");
?>


Apparently, it's the '#anchorhere' in the URI that causes Opera failed to redirect to that page. According to the HTTP/1.1 protocol, there is no restriction for using #anchor for the URI inside the header's Location field. I haven't test this with IE and FireFox myself but there are reports saying both IE and FF are working fine.
For more info, click here.
 SVG - Scalable Vector GraphicsFF VII - Advent Children 

Reader comments ( Add your comments )

- No comments (yet) -

Leave a public comment

Info Note: Neither BBCode nor HTML tags are supported currently.
Why ? Just to make my life easier and keep things simple.
Others: Comments that are longer than 1000 characters will be truncated.

    ) Info

Info

Info


Before you submit... verification

Please enter verification codes as seen in the image above to post your comment.
If you can't read the word, click here
(Your comment will be manually approved by admin before it's displayed to public)

$ view_blog.php 2009.09.17 18:16:41 $
Lost? | XML/HTML sitemap | Contact
38.107.179.240 , 22 queries , 0.0846s
Gzip enabled , CSS compressed , JS compressed
Copyright © 2005-2011 Darren's Outpost