Originally posted by King Cnvt
View Post
More importantly, MS's XML team state that you should not use the Microsoft.XMLHTTP ProgID, as this a legacy ProgID, and is not guaranteed to be supported (and apparently isn't supported by MSXML2 version 6, in Vista but also to be encountered in some XP installations). You should always use an MSXML2.* ProgID when using the old ActiveXObject method of instantiation.
So the best way of dealing with non-IE7 Windows systems would be:
Code:
if (window.XMLHttpRequest) {
// use the XMLHttpRequest constructor
} else {
if (window.ActiveXObject) {
// whole bunch of garbage trying to get an instantiation by try-catching a lot for different versions of the MSXML DLL with various versions of MSXML2 ProgIDs, eventually leading to...
} else {
// XHR not supported - please don't shit on the user here
}
}
As such Ajaxey gubbins should only be implemented as a form of progressive enhancement, "falling back" in this case means "behaving normally", and if XHR is supported, then the application behaves "normally, but better".
There are also certain techniques related to the fact that, in JavaScript, functions are objects, and object properties (including methods, because they are just properties, being functions, which are objects) can be dynamically modified, which allow for a number of optimisations - but the margins of this post are too small to contain them



Leave a comment: