Log in

View Full Version : Detecting if user can accept gzip?


Mark Hewitt
10-28-2002, 09:52 AM
I'm thinking of including a hack in my forum which would provide extra information in forumdisplay, (specifically a preview of each thread).

However being mindful of bandwidth usage etc, I would like to be able to send the "enhanced" version of the page only to those who have opted to receive it and are able to get gzipped versions of the pages, it would likely use too many resources to send it un-gzipped.

So is there a way I can do e.g.
if($bbuser == gzipOn)
{
// do this
}

Thanks :D

Mark.

Erwin
10-28-2002, 11:04 AM
As far as I know, the ability to view GZIP pages depends on the user's browser, and all the latest browsers down to Netscape 4.7 can read GZIP pages. I know that this can be switched off with certain browser plugins. I don't know if you can detect this though.

Takara
10-29-2002, 04:57 AM
if (eregi("gzip", $HTTP_ACCEPT_ENCODING)) {
echo "WAI! gzip is on~";
}


$HTTP_ACCEPT_ENCODING is an environmental variable.. so, if you have register_globals on then I think you'll have to do something else with it ($_SERVER? dunno)