Re: Hey, hey, hey

by HJVisualGallerys(at)aol.com

 Date:  Fri, 14 Dec 2001 05:03:36 EST
 To:  hwg-basics(at)hwg.org
  todo: View Thread, Original
darrell(at)webctr.com writes:
    Yes, you do:
 1) Visitor arrives at the site
 2) PHP code sniffs browser

Hi-
Embedding something like this, right in a web page, anywhere in the body -=20
this won't redirect, but it's the sniffer :
<?php  =20
$browser_type =3D getenv("HTTP_USER_AGENT");
    if (preg_match("/compatible; MSIE/i", "$browser_type")) {
      echo "Hello MS internet Explorer user! ";
    } else  if (preg_match("/Mozilla/i", "$browser_type")) {
        echo "Hello Netscape user! ";
    } else {
        echo Hello "$browser_type" surfer!;
    }
?>=20

Try it out on a webpage if you have access to a pHp server, before the=20
eclipse of Dec 14th disappears. :-) =20

Trying to detect a browser for any crucial internet operations with=20
javascript may not be the best use for javascript, considering, Javascript I=
S=20
disabled in many browsers. Keep js for the intranets!=20

Very Best,=20

Stephen=20
LTPAA
http://livetopaint.org/=20
=20
=A0---- "Art teaches us nothing, except the significance of life" - Henry=20
Miller=20

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA