homepage Welcome to WebmasterWorld Guest from 54.204.58.87
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP header, long URLs and Internet Explorer
zudorsoft




msg:4181695
 9:18 am on Aug 4, 2010 (gmt 0)

There was an old topic (already closed) about the same issue, actually without any reasonable answer what is happening.
We faced the same problem so I thought I post a short description and solution of the problem here to make others' live easier. ;-)


Old post:
[webmasterworld.com...]

The problem:
PHP header command (using 'refresh', 'location' or any other URL-related command) does not work in IE6 (and some versions of IE7) if the URL is longer then 255 chars.

Solutions:

1.) Use HTML META refresh tag:
<meta http-equiv="refresh" content="5;url=LONGURL">
(used by Travelgrove for example).
2.) Use JS redirects:
<script type='text/javascript'>
if (version>=4 || window.location.replace)
setTimeout("window.location.replace('LONGURL')",1000);
else
window.location.href = "LONGURL";
</script>
CAREFUL! LONGURL should contain ' and " encoded: %22 and %27.
(Used by travelgrove.com [travelgrove.com] and bookingwiz).

3.) Do NOT use too long URLs at all. :P

 

enigma1




msg:4181721
 11:34 am on Aug 4, 2010 (gmt 0)

PHP header command (using 'refresh', 'location' or any other URL-related command) does not work in IE6 (and some versions of IE7) if the URL is longer then 255 chars.


I do not see this problem with the PHP header location at least and IE6. Make sure you don't emit garbage characters in the url.

Example:
<?php
$string = 'http://www.example.com/?';
for($i=0, $j=100; $i<$j; $i++) {
$string .= 'test' . $i . '=' . 'test' . $i . '&';
}
header('Location: ' . $string);
exit();
?>

You should fix the application code imo.

zudorsoft




msg:4183142
 3:14 pm on Aug 6, 2010 (gmt 0)

You are right, sorry - only the Refresh header fails:

header("Refresh: 5; url=http://www.travelgrove.com/?a[]=1&b[]=2&c[]=3&a[]=1&b[]=2&c[]=3&a[]=1&b[]=2&c[]=3&a[]=1&b[]=2&c[]=3&a[]=1&b[]=2&c[]=3&a[]=1&b[]=2&c[]=3&a[]=1&b[]=2&c[]=3&a[]=1&b[]=2&c[]=3&a[]=1&b[]=2&c[]=3&a[]=1&b[]=2&c[]=3&a[]=1&b[]=2&c[]=3&a[]=1&b[]=2&c[]=3&a[]=1&b[]=2&c[]=3&a[]=1&b[]=2&c[]=3");


You can check it here:
[travelgrove.com...]
It does not work for me in IE6/7.

Thanks for your contribution.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved