[ka-Map-dev] problem in print_map.php on IE6

Jorge de Jesus jjesus at ualg.pt
Tue Jun 12 12:26:38 EDT 2007


Hi

I have been working with Ka-Aqua for a project and I was using the
print_map.php  to download some images, and for my big surprise it gave
an error like this in IE6

"Internet Explorer cannot download...cale12000000&output_type=JPEG"

"Internet Explorer was not able to open this Internet site"

I discovered that the header structure inside print_map.php wasn't the
best, and searching on some forums and the PHP site I have found that
this is the best solutution


$mm_type="image".strtolower($_REQUEST['output_type']);
$filename_ext=$oMap->name . ".".strtolower($_REQUEST['output_type']);
//This is the Headers to force a browser to use fresh content (no
caching) in HTTP/1.0 and HTTP/1.1:
// \n necessary for IE 7
header("Cache-Control: public, must-revalidate\n");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT\n");
header('Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT'.'\n');
header("Cache-Control: no-store, no-cache, must-revalidate\n");
header("Cache-Control: post-check=0, pre-check=0\n", false );
header("Pragma: Internet Explorer is shitty\n"); //What the Fuck ?!
header("Content-Type: " . $mm_type."\n");
header("Content-Length: " .(string)(filesize($szImg))."\n");
header('Content-Disposition: attachment; filename='.$filename_ext."\n");
header("Content-Transfer-Encoding: binary\n");
fpassthru($h);
fclose($h);

-The headers for what I read are prepared for non-cache in HTTP 1.0 and
1.1 and will work for IE, firefox and Opera
-Without the Pragma: (something), IE will give the  error (explained
above), I haven't found why, but is what people do
- The \n is seems to be necessary for IE7 that needs a more tight header
(but I haven't checked if it's true).

I hope that this helped

-- 

Eng. Jorge S. M. de Jesus
GIS researcher
Universidade do Algarve
Faculdade de Engenharia e Recursos Naturais
Office: L19
Mobile: +351 96 5656781
Skype: Jorge.de.Jesus
Technical blog: http://jesus-loves-grass.blogspot.com



More information about the ka-Map-dev mailing list