/    Sign up×
Community /Pin to ProfileBookmark

Browser version detector

I am Wondernig how to do i go about detecting versions in php so if user A has internet explorer 6 and user b has internet explorer 7 and user c has firefox 1.5.0.2 and user d has netscape (latest version)

How can i make it so it automatically detects and switchs css style templates in php.

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@ZnupiSep 26.2006 — http://php.net/manual/en/function.get-browser.php

Aaand if you don't have the browscap.ini, read through the user notes ?
Copy linkTweet thisAlerts:
@felgallSep 27.2006 — That just extracts the info from the useragent and browsers often put values in that to masquerade as Internet Explorer.

IE is the only browser where you need different CSS (the others all follow the standards fairly closely). Microsoft have added special conditional statements to their version of HTML that makes it easy to test for IE in the HTML of any page.

<link rel="stylesheet" href="main.css" type="text/css">
<!--[if eq IE 7]>
<link rel="stylesheet" href="ie7.css" type="text/css">
<[endif]><[if lte IE 6]>
<link rel="stylesheet" href="ie6.css" type="text/css">
<[endif]-->
Copy linkTweet thisAlerts:
@william232authorOct 06.2006 — how can i do that with if the browser works i have tried it in ie and firefox but does not seem to work.
×

Success!

Help @william232 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.16,
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,
)...