W3C home > Mailing lists > Public > public-bpwg@w3.org > February 2008

Suggested BP for BP 2 : Use Javascript reflection to check for available functionalities avoiding the user agent string

From: Josť Manuel Cantera Fonseca <jmcf@tid.es>
Date: Tue, 26 Feb 2008 16:14:49 +0100
To: MWI BPWG Public <public-bpwg@w3.org>
Message-id: <47C42CE9.5090807@tid.es>

BP

Use Javascript reflection to check for available functionalities 
avoiding parsing the user agent string

The user agent string cannot be trusted while trying to figure out what 
are the script functionalities available

How to do it (example)

Use Javascript Reflection and if statements

if(window.ActiveXObject) {
   // Instantiate using new ActiveXObject
}
else if(window.XMLHttpRequest) {
    // Instantiate using new XMHttpRequest
}
Received on Tuesday, 26 February 2008 15:13:16 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:51 UTC