471,338 Members | 1,305 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,338 software developers and data experts.

Determining if user is using Win98 & MSIE

If a user is using a combination of Win98 & any version of MSIE, I
want to display a message.
The best that I can do is the following:
<?
if ((strstr (getenv('HTTP_USER_AGENT'), 'MSIE')) && (strstr
(getenv('HTTP_USER_AGENT'), '98')))
{
echo"blah,blah,blah\n";
}
?>
Is there a better (more foolproof) way?
Thanks!
Jul 23 '05 #1
4 1342
- Dazed wrote:
If a user is using a combination of Win98 & any version of MSIE, I
want to display a message.
That's not as easy as you think it might be.
The best that I can do is the following:
<?
if ((strstr (getenv('HTTP_USER_AGENT'), 'MSIE')) && (strstr
(getenv('HTTP_USER_AGENT'), '98')))
{
echo"blah,blah,blah\n";
}
?>
Is there a better (more foolproof) way?


Yes and no. Browser Detection based on the User Agent String is very
fundamentally flawed since many browsers spoof other browsers since
sites think they need to give certain browsers messages, or totally
different pages, because they think they know what browser the user is
using.

And when using Mozilla, I can make it pass your above test even though
it is not MSIE and it is not running on Windows98. So what exactly is
the problem you are trying to solve?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2
Randy Webb <Hi************@aol.com> wrotc:
- Dazed wrote:
If a user is using a combination of Win98 & any version of MSIE, I
want to display a message.


That's not as easy as you think it might be.
The best that I can do is the following:
<?
if ((strstr (getenv('HTTP_USER_AGENT'), 'MSIE')) && (strstr
(getenv('HTTP_USER_AGENT'), '98')))
{
echo"blah,blah,blah\n";
}
?>
Is there a better (more foolproof) way?


Yes and no. Browser Detection based on the User Agent String is very
fundamentally flawed since many browsers spoof other browsers since
sites think they need to give certain browsers messages, or totally
different pages, because they think they know what browser the user is
using.

And when using Mozilla, I can make it pass your above test even though
it is not MSIE and it is not running on Windows98. So what exactly is
the problem you are trying to solve?

There has been an occasional site inconsistency when a user is using a
combination of Win98 & MSIE. Never with WinME, Win2K or WinXP. If they
are using a combination of Win98 & MSIE, I want to display a message
as such.
Jul 23 '05 #3
- Dazed wrote:
Randy Webb <Hi************@aol.com> wrotc:

- Dazed wrote:
<--snip-->
And when using Mozilla, I can make it pass your above test even though
it is not MSIE and it is not running on Windows98. So what exactly is
the problem you are trying to solve?
There has been an occasional site inconsistency when a user is using a
combination of Win98 & MSIE.


And what exactly is that "inconsistency"?
Never with WinME, Win2K or WinXP.
If they are using a combination of Win98 & MSIE, I want to display a
message as such.


And there lies the problem. The issue of determining browser and OS is
asked so often that it is addressed directly in this group's FAQ:

http://jibbering.com/faq/#FAQ4_26
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #4
- Dazed wrote:
If a user is using a combination of Win98 & any version of MSIE, I
want to display a message.
The best that I can do is the following:
<?
if ((strstr (getenv('HTTP_USER_AGENT'), 'MSIE')) && (strstr
(getenv('HTTP_USER_AGENT'), '98')))
{
echo"blah,blah,blah\n";
}
?>
Is there a better (more foolproof) way?

In short, no - there is *no* "foolproof way". For instance, at the
moment I have my user-agent settings changed to (hopefully) be accurate
and say I am running Mozilla under WinXP, but quite often to fool just
such tests as this I change it to claim I am using MSIE and Win2K. More
often, I simply clear as much as possible of the settings so that it
tells the server nothing at all.

Your best bet is to actually think *why* you want that test and consider
if there is an alternative that is better.
Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Cliff Wells | last post: by
60 posts views Thread by Fotios | last post: by
4 posts views Thread by Randy Webb | last post: by
1 post views Thread by Jon Spivey | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.