note 15488 deleted from function.get-browser by sniper
| From: | sniper@php.net | Date: | Mon, 21 Oct 2002 01:52:14 +0000 |
| Subject: | note 15488 deleted from function.get-browser by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-38342@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!).