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

Determining if user is using Win98 & MSIE

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
- 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

P: n/a
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

P: n/a
- 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

P: n/a
- 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.