84 lines
3.1 KiB
XML
84 lines
3.1 KiB
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
|
|
<xlib_symbol id='xGlobals'>
|
|
|
|
<copyright>Copyright 2001-2005 Michael Foster (Cross-Browser.com)</copyright>
|
|
<license>Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL</license>
|
|
<groups>
|
|
<grp>Var</grp>
|
|
</groups>
|
|
<type>Var</type>
|
|
|
|
<description><![CDATA[This file documents the global variables which XC includes before any other js if the -glb option is not specified.]]></description>
|
|
|
|
<comments>
|
|
<comment>
|
|
<date></date>
|
|
<author>mf</author>
|
|
<note><![CDATA[
|
|
xUA - lowercase user-agent string
|
|
xOp7Up - true if browser is Opera 7 or greater
|
|
xOp6Dn - true if browser is Opera 6.x or less
|
|
xIE4 - true if browser is IE 4.x
|
|
xIE5 - true if browser is IE 5.x
|
|
xIE4Up - true if browser is IE 4 or greater
|
|
xNN4 - true if browser is Netscape Navigator 4.x
|
|
xMac - true if OS is Mac
|
|
|
|
For some browsers, the window resize and scroll events are simulated.
|
|
Some of the following variables may be used.
|
|
|
|
xPCW - previous clientWidth
|
|
xPCH - previous clientHeight
|
|
xREL - resize event listener
|
|
xPSL - previous scrollLeft
|
|
xPST - previous scrollTop
|
|
xSEL - scroll event listener
|
|
]]></note>
|
|
</comment>
|
|
<comment>
|
|
<date></date>
|
|
<author>mf</author>
|
|
<note><![CDATA[As much as possible, object-detection is used instead of browser-detection.]]></note>
|
|
</comment>
|
|
<comment>
|
|
<date></date>
|
|
<author>mf</author>
|
|
<note><![CDATA[Some notes from brothercake (thanks bro!):
|
|
---
|
|
Looks good as far as Opera's concerned, but Konqueror spoofs document.all, and can also identify as IE, so you'd need to add navigator.vendor != 'KDE' to your second test; but with that addition you no longer need to look for "msie" in the user agent string - having tested for document.all and not konqueror, and already knowing we're not Opera, only IE is left; then you can separate IE4 from IE5+ by testing for getElementById or another DOM1 collection.
|
|
|
|
Your gecko test will also identify Safari (which has "like gecko" in its UA string), and Konqueror if it's identifying as gecko - you could test against that with navigator.vendor again, but that wouldn't allow for gecko spoofing as something else - afaik there is no way to identify gecko reliably.
|
|
|
|
Why have a mac test? Do you need to know that someone's using a mac, over and above that they're using mac/ie5? For mac ie5 you can test (established IE) against window.attachEvent.
|
|
|
|
So all in all - the only UA information we really need is to identify Opera versions
|
|
cheers
|
|
James
|
|
---]]></note>
|
|
</comment>
|
|
</comments>
|
|
|
|
<revisions>
|
|
<rev>
|
|
<num>3</num>
|
|
<date>27Apr05</date>
|
|
<author>mf</author>
|
|
<note><![CDATA[removed xMoz, xOp7 and xOp5or6. Added xOp7Up and xOp6Dn. Thanks very much to brothercake, see notes.]]></note>
|
|
</rev>
|
|
<rev>
|
|
<num>2</num>
|
|
<date></date>
|
|
<author>mf</author>
|
|
<note><![CDATA[added more sniffer vars.]]></note>
|
|
</rev>
|
|
<rev>
|
|
<num>1</num>
|
|
<date>31Mar04</date>
|
|
<author>mf</author>
|
|
<note><![CDATA[put in it's own file for use with XC.]]></note>
|
|
</rev>
|
|
</revisions>
|
|
|
|
</xlib_symbol>
|