Determining OS

I

Ike

Is there a means of determining what Operating System a client is on. I am
trying to forward a client to a different page if they are on a Windows
system than on a different system, and am wondering just how this can
possibly be accomplished. Thanks, Ike
 
O

Oli Filth

Ike said:
Is there a means of determining what Operating System a client is on. I am
trying to forward a client to a different page if they are on a Windows
system than on a different system, and am wondering just how this can
possibly be accomplished. Thanks, Ike

You can do this from a server-side script using the HTTP_USER_AGENT
header. e.g. in PHP, the server variable $_SERVER["HTTP_USER_AGENT"]
contains a string that the user's browser sends to describe itself. e.g.:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107
Firefox/1.0
 
B

Barbara de Zoete

Ike said:
Is there a means of determining what Operating System a client is on. I am
trying to forward a client to a different page if they are on a Windows
system than on a different system, and am wondering just how this can
possibly be accomplished. Thanks, Ike

You can do this from a server-side script using the HTTP_USER_AGENT header.
e.g. in PHP, the server variable $_SERVER["HTTP_USER_AGENT"] contains a string
that the user's browser sends to describe itself. e.g.:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107
Firefox/1.0

Just curious: Why would one do that?



--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
 
D

David Dorward

Ike said:
Is there a means of determining what Operating System a client is on. I am
trying to forward a client to a different page if they are on a Windows
system than on a different system
Why?

and am wondering just how this can possibly be accomplished.

You can look at the User Agent string. Note, however, that it doesn't always
include the OS, and is often munged. Make sure that being redirected to the
wrong page will not inconvenience users.
 
S

Spartanicus

Ike said:
Is there a means of determining what Operating System a client is on.

Not reliably.
I am
trying to forward a client to a different page if they are on a Windows
system than on a different system, and am wondering just how this can
possibly be accomplished.

Let the user choose:

<a href="windows.htm">Windows OS</a>, <a href="other.htm">Other OS's</a>
 
O

Oli Filth

Barbara said:
Ike said:
Is there a means of determining what Operating System a client is on.
I am
trying to forward a client to a different page if they are on a Windows
system than on a different system, and am wondering just how this can
possibly be accomplished. Thanks, Ike

You can do this from a server-side script using the HTTP_USER_AGENT
header. e.g. in PHP, the server variable $_SERVER["HTTP_USER_AGENT"]
contains a string that the user's browser sends to describe itself.
e.g.:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5)
Gecko/20041107 Firefox/1.0

Just curious: Why would one do that?

Because it also contains a representation of the OS, which one could use
to perform redirection, etc. from the server.

Note that I should have said that this is less than reliable, as many
browsers send incorrect information (either by accident or on purpose).
 
B

Barbara de Zoete

Because it also contains a representation of the OS, which one could use to
perform redirection, etc. from the server.

I wasn't very clear, obviously. So let me refrase:

Why would one redirect based on the OS of the visitor?


--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
 
E

Els

Barbara said:
I wasn't very clear, obviously. So let me refrase:

Why would one redirect based on the OS of the visitor?

Maybe in case of OS specific downloads? Still not a good reason
to automate that process, as I do actually sometimes download
Linux stuff with Windows and vice versa. I then use the local
LAN to get it to the right place.
 
B

Barbara de Zoete

Maybe in case of OS specific downloads?

Makes sense.
Still not a good reason
to automate that process, as I do actually sometimes download
Linux stuff with Windows and vice versa. I then use the local
LAN to get it to the right place.

Makes more sense. :)

--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
 
D

David Dorward

Maybe in case of OS specific downloads? Still not a good reason
to automate that process

Its a reasonable way to choose between a page with a big, obvious Windows
download link along with a lot of less obvious links for other systems, and
a page with a big obvious Mac download link along with ... etc etc.
 
E

Els

David said:
Its a reasonable way to choose between a page with a big,
obvious Windows download link along with a lot of less
obvious links for other systems, and a page with a big
obvious Mac download link along with ... etc etc.

Agreed :)
 
I

Ike

Because, I have a Java Applet which uses Microspft SAPI speech engine (or
not) -- If they have Windows, I branch to a page that uses the Applet that
has SAPI, otherwise, to the page that doesn't! -Ike
 
B

Barbara de Zoete

Please, do not toppost. Corrected this once.
Because, I have a Java Applet which uses Microspft SAPI speech engine (or
not) -- If they have Windows, I branch to a page that uses the Applet that
has SAPI, otherwise, to the page that doesn't! -Ike

Oh, wow. So I use Opera as my main browser, doesn't allow Java, Java-applet,
JavaScript, and certainly not any other active content. It does run on a
WindowsXP machine, so I get (re)directed to a page that does not work at all.
Nice punishment for not having switched to a decent OS. Thank you very much :p

Please delete signature as it is not part of the message you reply to.

--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
 
O

Oli Filth

Ike said:
Because, I have a Java Applet which uses Microspft SAPI speech engine (or
not) -- If they have Windows, I branch to a page that uses the Applet that
has SAPI, otherwise, to the page that doesn't! -Ike

Would it not make more sense to perform the OS check within the Java
applet (e.g. using System.getProperty("os.name") or whatever), and not
the containing page?
 
T

Travis Newbury

Barbara said:
Oh, wow. So I use Opera as my main browser, doesn't allow Java,
Java-applet, JavaScript, and certainly not any other active content. It
does run on a WindowsXP machine, so I get (re)directed to a page that
does not work at all. Nice punishment for not having switched to a
decent OS. Thank you very much :p

Well that is the price for being on the cutting edge and using a
minority browser. I guess there are consequences for our actions. For
the OP, he loses you as a customer. For you, you lose the content he
was going to show.
 
R

Richard

On Sat, 05 Feb 2005 16:28:59 GMT, Oli Filth
<[email protected]>
wrote:
You can do this from a server-side script using the HTTP_USER_AGENT
header.
e.g. in PHP, the server variable $_SERVER["HTTP_USER_AGENT"] contains
a string
that the user's browser sends to describe itself. e.g.:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5)
Gecko/20041107
Firefox/1.0

Just curious: Why would one do that?

A lot of counter stats use the routine to show the user what operating
systems and browsers were used, not to mention screen resolution.
If you're that worried about showing the proper page to the visitor, then
you could use it to reroute the visitor to an appropriate page.
For instance, a visitor is using IE and due to the peculiarities of IE, you
might have a page written just for them, where the same page would not work
in netscape.
 
B

Blinky the Shark

Travis said:
Barbara de Zoete wrote:
Well that is the price for being on the cutting edge and using a
minority browser. I guess there are consequences for our actions. For

No, that's what happens when you've configured your Java- and
JavaScript-capable browser not to do Java or JavaScript.
 
B

Blinky the Shark

Blinky said:
Travis Newbury wrote:
No, that's what happens when you've configured your Java- and
JavaScript-capable browser not to do Java or JavaScript.

Which statement should not be taken to mean that such control and
exercise of it are bad things. I simply meant that it's not a matter
of using a non-Redmond browser; it's a matter of the user having choices
of how the browser is used.
 
T

Toby Inkster

Travis said:
Well that is the price for being on the cutting edge and using a
minority browser.

To clarify Barbara's statement, Opera supports Java and Javascript just
fine, but Barbara has chosen to disable them.
 
B

Barbara de Zoete

Well that is the price for being on the cutting edge and using a minority
browser. I guess there are consequences for our actions. For the OP, he
loses you as a customer. For you, you lose the content he was going to show.

Wooh, wow. I wonder who loses the most ;-)

As others pointed out my 'doesn't' in 'So I use Opera as my main browser,
doesn't allow ...' should have been don't. Opera gives me the choice to easily
enable or disable all that stuff. I choose to disable it.

--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top