By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,557 Members | 1,406 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,557 IT Pros & Developers. It's quick & easy.

Detect the users operating system using PHP

P: n/a
Hi,

Is it possible to detect a users operating system using PHP or is this
something for Javascript? I ask because I am trying getting some bugs
with a minor javascript script that is generating bugs when run using
IE on the Mac. The javascript, although a fancy feature, isnt all that
important to the page so Im just going to disable it from the server
for Mac users (sorry guys), at least until I figure out the way it will
display on the Mac.

I havent yet tested it in non-IE browsers (Firefox, Opera etc) on the
Mac. Can I also find out what browser software the Mac user is using.
If it works in other Mac browsers I can simply just disable it for IE
Mac users.

Cheers

Burnsy

Jun 20 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Tue, 20 Jun 2006 03:09:06 -0700, bizt wrote:
Is it possible to detect a users operating system using PHP or is this
something for Javascript? I ask because I am trying getting some bugs with
a minor javascript script that is generating bugs when run using IE on the
Mac. The javascript, although a fancy feature, isnt all that important to
the page so Im just going to disable it from the server for Mac users
(sorry guys), at least until I figure out the way it will display on the
Mac.

I havent yet tested it in non-IE browsers (Firefox, Opera etc) on the Mac.
Can I also find out what browser software the Mac user is using. If it
works in other Mac browsers I can simply just disable it for IE Mac users.


It's not always reliable (it can be faked), but $_SERVER["USER_AGENT"]
should do for your purposes.

Cheers,
Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

Jun 20 '06 #2

P: n/a
On Tue, 20 Jun 2006 03:09:06 -0700, bizt wrote:
Hi,

Is it possible to detect a users operating system using PHP or is this
something for Javascript? I ask because I am trying getting some bugs
with a minor javascript script that is generating bugs when run using
IE on the Mac. The javascript, although a fancy feature, isnt all that
important to the page so Im just going to disable it from the server
for Mac users (sorry guys), at least until I figure out the way it will
display on the Mac.

I havent yet tested it in non-IE browsers (Firefox, Opera etc) on the
Mac. Can I also find out what browser software the Mac user is using.
If it works in other Mac browsers I can simply just disable it for IE
Mac users.

Cheers

There is get_browser() function which will return a hash with different
fields, one of which is "platform". More details can be seen at:

http://us3.php.net/manual/en/function.get-browser.php

I can only imagine what the "stripper" field does.
--
http://www.mgogala.com

Jun 20 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.