473,383 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

FAQ Topic - How do I detect Opera/Netscape/IE?

-----------------------------------------------------------------------
FAQ Topic - How do I detect Opera/Netscape/IE?
-----------------------------------------------------------------------

The ` navigator ` object contains strings which
specify the browser and version; however, this is in general not
very genuine. Mozilla (and therefore Netscape 6+) allows this to
be freely set, and Opera and IE allow it to be modified. There
are also at least 25 other javascript capable browsers with
their own strings here.

Generally though, you don't need to identify which browser is
being used. There are alternative techniques, but which one you
choose depends on why you want to redirect browsers. If it's to
offer different CSS stylesheets, then

http://w3development.de/css/hide_css_from_browsers/

shows many techniques. For Scripting, _object_ detection
is a better method to use.

http://www.quirksmode.org/js/support.html

It is also known as feature detection.

Object/feature detection means checking that the object you wish
to use is supported by the browser before using it. This means
that you don't need to know what browsers support what methods,
and your code will automatically be usable on any browser that
can execute it.

if (document.getElementById &&
document.getElementById('el') &&
document.getElementById('el').style ) {
// We know that this browser supports getElementByID and has
// a style object, so we can set a style property.
document.getElementById('el').style.color="red";
}

Browser bugs can often be detected and overcome in similar ways.

http://www.jibbering.com/faq/faq_not...er_detect.html

http://developer.apple.com/internet/...detection.html
===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://jibbering.com/faq/index.html.
The FAQ workers are a group of volunteers.

Mar 4 '07 #1
4 3777
FAQ server said the following on 3/3/2007 7:00 PM:
-----------------------------------------------------------------------
FAQ Topic - How do I detect Opera/Netscape/IE?
-----------------------------------------------------------------------
How do I detect the user's browser?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 4 '07 #2
FAQ server wrote :
-----------------------------------------------------------------------
FAQ Topic - How do I detect Opera/Netscape/IE?
-----------------------------------------------------------------------
[snipped]
If it's to
offer different CSS stylesheets, then

http://w3development.de/css/hide_css_from_browsers/

shows many techniques.
That document is clearly outdated, almost rusted. The most recent
Mozilla-based browser listed in the Summary of possible methods table is
NS 6.2 (2001). And most methods based on lack of support (like child
selector, attribute selector) fail in MSIE7. So, that document is pretty
useless, definitely not FAQ-worthy.
IE conditional comment is not even mentioned, discussed or explained in
that document: that's a rather serious omission.

Gérard
--
Using Web Standards in your Web Pages (Updated Dec. 2006)
http://developer.mozilla.org/en/docs...your_Web_Pages
Mar 4 '07 #3
Randy Webb wrote:
FAQ server said the following on 3/3/2007 7:00 PM:
>-----------------------------------------------------------------------
FAQ Topic - How do I detect Opera/Netscape/IE?
-----------------------------------------------------------------------

How do I detect the user's browser?
Wouldn't the user's browser be implied and so not need detecting?
Determining the type/version of the user's browser is question being
asked.

Richard.

Mar 4 '07 #4
Richard Cornford said the following on 3/4/2007 6:39 AM:
Randy Webb wrote:
>FAQ server said the following on 3/3/2007 7:00 PM:
>>-----------------------------------------------------------------------
FAQ Topic - How do I detect Opera/Netscape/IE?
-----------------------------------------------------------------------

How do I detect the user's browser?

Wouldn't the user's browser be implied and so not need detecting?
Determining the type/version of the user's browser is question being asked.
My point was that limiting the question to Opera/Netscape/IE is very
outdated and wrong.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 4 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I detect Opera/Netscape/IE? ----------------------------------------------------------------------- The...
8
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I disable the right mouse button? -----------------------------------------------------------------------...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.