RE: [Zope] Detecting Mozilla based browsers
[Gilles Lenfant]
I'm trying to detect (server side) Mozilla+Midas compatible browsers. Since this feature (Midas) is new, finding "Gecko" in the user agent signature doesn't seem to be enough.
Any clue ? Does it need a Javascript helper ?
IE does not use the name "cssRules" as per the DOM Rec, while Moz does. You can discover this somewhat as follows - var stylesheet=document.styleSheets[0] var rules=stylesheet.rules var UA if (rules) { // Must be IE UA = 'IE' } else { rules = stylesheet.cssRules if (rules) { // Correct DOM name - probably Moz UA = 'Moz' } } For this to work, there must be a css stylesheet in the document, or document.stylesSheets[0] will fail. Now it may happen that some other browser would pass this test, so you would want to try several such tests. One possibility is the XMLHTTPREQUEST object, which exists in both browsers but gets instantiated differently - see http://jibbering.com/2002/4/httprequest.html Cheers, Tom P
participants (1)
-
Passin, Tom