Forgot Password / Register
Site Statistics
Total Members: 509
Total Tutorials: 242
Newsest User: Lestop
Todays Unique Hits: 112
0 Users 2 Guests Online

Browser Detector...

Easy tutorial to find out if your user is using FireFox or Internet Explorer.
Code
<?php
$browser = $_SERVER['HTTP_USER_AGENT']; //gets the browser

if($browser == 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3') {
echo "Mozilla FireFox";
}

if($browser == 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2)') {
echo "Internet Explorer";
}
?>


Simple enough, you can add others if you which, but those are the two most used. I hope this comes in handy!
Diablosblizz
Views:
1949
Rating:
Posted on Sunday 23rd September 2007 at 08:40 PM
darklight19
darklight19
This won't work if you have a tool bar installed that renames the user agent.
Posted on Thursday 24th May 2007 at 11:58 PM
ShadowMage
ShadowMage
no prob
Posted on Thursday 24th May 2007 at 11:40 PM
Jon
Jon
nvm fixed it, I changed the "en-US" to "en-GB"...

Thanks guys.
Posted on Thursday 24th May 2007 at 11:37 PM
Jon
Jon
Yes
Posted on Thursday 24th May 2007 at 11:32 PM
ShadowMage
ShadowMage
it works for me also, does your host support PHP?
Posted on Thursday 24th May 2007 at 11:15 PM
Jon
Jon
I'm on Firefox.
Posted on Thursday 24th May 2007 at 05:44 AM
SkillMaster
SkillMaster
Works fine for me. what browser are you using it seems to work fine in IE and mozilla for me.
Posted on Wednesday 23rd May 2007 at 09:21 PM
Jon
Jon
Basically, nothing shows up when I go on it:

http://scription.net/browser.php
Posted on Friday 18th May 2007 at 09:45 PM
SkillMaster
SkillMaster
Yes it does work for me. :S what is your exact problem?
Posted on Thursday 17th May 2007 at 11:35 PM
Diablosblizz
Diablosblizz
Could you please say whats wrong? I tested it before I tried. It works with both Internet Explorer and Firefox - as the other browsers (Opera, and NetScape) will NOT work.

Please specify whats wrong and if there is an error.