bobzimuta said the following on 7/13/2006 12:04 PM:
Unlike the last poster,
What "last poster"? You mean the one who quoted properly and didn't turn
the post upside down?
I'll try to give you some info.
And the "last poster" didn't? I did, it just wasn't what you thought you
would see is all.
Please check out these references and look at the objects and their properties
http://msdn.microsoft.com/library/de...ce/objects.asp
http://developer.mozilla.org/en/docs..._DOM_Reference
In particular would be the properties of window.navigator (also called
window.clientInformation in IE).
All of which is unreliable and easily spoofed which makes it useless to
anybody that knows anything about them.
Just be sure not to try to access non-properties of objects.
Feature detection and then you don't *care* what browser it is.
For example, mozilla browsers don't have the
window.clientInformation so use something like the following.
var clientInformation = {};
if( window.clientInformation )
That test, with the code, doesn't do what you think it does.
alert(window.clientInformation) //---[object Object]
Without the var clientInformation, it alerts [object Navigator]
If you want the navigator object, just refer to it directly:
window.navigator
{
if( window.clientInformation.cpuClass )
clientInformation[ 'cpuClass' ] =
window.clientInformation.cpuClass;
}
This will avoid exceptions when trying to query the properties
It is called "feature detection" and when you properly feature detect,
the browser becomes irrelevant. Even when the UA is not a browser at all.
--
Randy
comp.lang.javascript FAQ -
http://jibbering.com/faq & newsgroup weekly
Temporarily at:
http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/