/    Sign up×
Community /Pin to ProfileBookmark

Detection of browser type

Hi, I don’t know whether PHP is suitable for this, but is there a way to detect whether a site visitor is using say IE or FF (thus triggering alternate codes for both). Many thanks!

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJan 25.2006 — You could try parsing it from the $_SERVER['HTTP_USER_AGENT'] variable, or use the get_browser() function (but see the set-up requirements at http://us3.php.net/manual/en/function.get-browser.php ).
Copy linkTweet thisAlerts:
@nickismeauthorJan 25.2006 — Cheers NogDog, I'll look into that
Copy linkTweet thisAlerts:
@CharlesJan 25.2006 — I was looking into this just yesterday. I'm trying to figure out how to tell if the requestion UA is an hand held device.
Copy linkTweet thisAlerts:
@NogDogJan 25.2006 — I was looking into this just yesterday. I'm trying to figure out how to tell if the requestion UA is an hand held device.[/QUOTE]
Possibly (i.e., completely untested):
[code=php]
$browser = get_browser(null, true);
if($browser['wap'])
{
// it's probably a hand-held?
}
[/code]

This is the browsecap.ini file I was looking at: http://www.garykeith.com/browsers/stream.asp?PHP_BrowsCapINI
×

Success!

Help @nickisme spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...