The simplest way for gzip compression (PHP)

ob_start("ob_gzhandler") returns FALSE if browser doesn’t support gzip, so then is called normal ob_start();

You can use the browser header information to see if the page is compressed or a tool that checks this for you.