WML-WAP

Detecting WAP/WML or Web/HTML Browser

I use this little script to detect what browser is being used by the visitor. Is it web browser or WAP browser. Yes, I want my domain accessible by two kind of browser and redirect them to the specific page (ie. web or WAP).

So if visitor open my homepage using web browser (Opera, Firefox, Safari, Internet Explorer, Kameleon, Konqueror, Flock, etc), he will be brought to a web page. Otherwise, if he open my homepage using WAP browser (browser on cellular phone), he will be redirected into a specific page designed for tiny screen.

Here is the script, I write as index.php and put it in the root directory of my homepage. It might be public_html, www, htdocs or whatever it named.

< ? if(eregi("text/vnd.wap.wml",$_SERVER['HTTP_ACCEPT'])){ header('Location: ./wap/'); } else{ header('Location: ./web/'); } ?>

For your information, directory wap/ is place for my WML scripts and web/ is place for my HTML and PHP scripts.

 

1 Comment

  1. Wah, saran yang bagus…
    aku coba ya mas….

    seep, silahkan dicoba dan disebarluaskan 😉

Leave a Reply