Question

I can't seem to find an answer to this anywhere. It's well known that certain versions of IE6 and earlier incorrectly declare they accept gzip encoding. Does ob_gzhandler correctly detect these versions or do you need to do that separately?

Was it helpful?

Solution

No, it doesn't; you have to, like so:

<?
function checkIEFail() {
    $ua = $_SERVER['HTTP_USER_AGENT'];
    if(strpos($ua, 'Mozilla/4.0 (compatible; MSIE ') !== 0 || strpos($ua, 'Opera') !== false)
        return false;
    $version = floatval(substr($ua, 30));
    return $version < 6 || ($version == 6 && strpos($ua, 'SV1') === false);
}

if(!checkIEFail())
    ob_start('ob_gzhandler');
?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top