note 15488 added to function.get-browser

From: Date: Thu, 13 Sep 2001 15:39:11 +0000
Subject: note 15488 added to function.get-browser
Groups: php.notes 
Request: Send a blank email to php-notes+get-17984@lists.php.net to get a copy of this message
I was getting very tired of the differences between Netscape and Microsoft Internet Explorer (like the problem of adding margins and the cutting of pixels in frames by Netscape), so I used this workaround: I made a function which detects which browser is used and echoes $ns in case of Netscape and $ie in case of MIE: function browser($ns,$ie) { global $HTTP_USER_AGENT; if ((stristr($HTTP_USER_AGENT, "Mozilla") && (!(stristr($HTTP_USER_AGENT, "compatible"))))==1) echo $ns; else echo $ie; } Wherever I need different values for the two different browsers, I just call <?php browser(value ns, value ie); ?> Certainly, it's not nice. But it works. Now my website looks almost the same in Netscape and MIE (finally!). http://www.php.net/manual/en/function.get-browser.php

« previous php.notes (#17984) next »