Instantiating XHR (Code Worth Recommending Project)

M

Martin Honnen

Do you have a link to a bit of Microsoft documentation that states the
above?

See the MSXML SDK
<URL:http://msdn2.microsoft.com/en-us/library/ms757837.aspx>, it states
the following:

"MSXML version 3.0 was the last version of MSXML to support
version-independent GUIDs and ProgIDs. Starting with version 4.0, MSXML
is installed on your computer in side-by-side mode. This means that, for
example, installing MSXML 5.0 for Microsoft Office Applications does not
replace any previously installed version of the MSXML parser on your
computer. This is done to protect the quality of applications that are
currently using earlier versions of MSXML. Side-by-side mode also allows
you to decide which version of the parser to use in your code.

After you install MSXML 4.0 or later, applications that use
version-independent ProgIDs continue to run using the most recent
version of MSXML prior to version 4.0. Typically, for most current
Windows systems, this will be MSXML 3.0. To use version 4.0 or later,
however, applications must be written to use the appropriate
version-dependent class IDs (CLSIDs) and ProgIDs that reference the
appropriate DLL (Msxml4.dll, Msxml5.dll, and so on)."
 
M

Martin Honnen

Randy said:
Thank you Martin. Is there any property you can check that will tell you
which version that microsoft/Msxml2.XMLHTTP is bound to?

var xmlhttp = new ActiveX('Msxml2.XMLHTTP');
var xmlhttpVersion = xmlhttp.whatPropertyToUseHere;

Any way to know?

There is no object property you can inspect. There are tools however to
check the current settings, see
<URL:http://support.microsoft.com/kb/278674/en-us>.
 
P

Peter Michaux

See the MSXML SDK
<URL:http://msdn2.microsoft.com/en-us/library/ms757837.aspx>, it states
the following:

"MSXML version 3.0 was the last version of MSXML to support
version-independent GUIDs and ProgIDs. Starting with version 4.0, MSXML
is installed on your computer in side-by-side mode. This means that, for
example, installing MSXML 5.0 for Microsoft Office Applications does not
replace any previously installed version of the MSXML parser on your
computer. This is done to protect the quality of applications that are
currently using earlier versions of MSXML. Side-by-side mode also allows
you to decide which version of the parser to use in your code.

After you install MSXML 4.0 or later, applications that use
version-independent ProgIDs continue to run using the most recent
version of MSXML prior to version 4.0. Typically, for most current
Windows systems, this will be MSXML 3.0. To use version 4.0 or later,
however, applications must be written to use the appropriate
version-dependent class IDs (CLSIDs) and ProgIDs that reference the
appropriate DLL (Msxml4.dll, Msxml5.dll, and so on)."

Thank you.

If a version-independent classid/progid is to be used then it seems
"Microsoft.XMLHTTP" is better than using "Msxml2.XMLHTTP" as the
former will work with earlier msxml dll files. A developer could
optionally add the "Msxml.XMLHTTP.6.0" as a first choice.

I suppose this comes down to the developer's feelings on testing
resources available. If the developer has limited resources and is ok
with using the newest dll up to 3.0 that is available on the machine
and not testing every possible combination of browsers/dlls then the
developer could use "Microsoft.XMLHTTP". If the developer only tests
with msxml3.dll and thinks the code should be tested in every
combination in which XHR instantiation will work then the developer
could use only "Msxml2.XMLHTTP.3.0". Using "Msxml2.XMLHTTP.6.0" would
add yet another combination to be tested.

I have frequently seen the following as part of Ajax libraries to be
tried in order

var msxml = [
'MSXML2.XMLHTTP.3.0',
'MSXML2.XMLHTTP',
'Microsoft.XMLHTTP'
];

and given this discussion it seems this is equivalent to just

var msxml = [
'Microsoft.XMLHTTP'
];
 
V

VK

and given this discussion it seems this is equivalent to just

var msxml = [
'Microsoft.XMLHTTP'
];

Bingo! It took 22 extra posts to come to what it was said in the very
first reply in this thread :)

Again: just don't forget that is totally true only for ajaxoids (XHRs)
so for making new HTTP requests from the same page, grab the server
response and handle it manually.

For a real complex XML tasks the used version may be of a big
importance.
 
V

VK

Microsoft.XMLHTTP will *not* use the "latest version on the machine". It
uses the latest up to 3.0 and nothing later. I have 6.0 available on
this machine but Microsoft.XMLHTTP will not instantiate it. It will use
3.0 instead.

Right, and never stated the opposite. Please read my very first post:

"Now coming back to the original question of XMLHTTP versioning. If
the ajaxoid is "standardly misused" as a hidden browser to get textual
data from the server then it is irrelevant what version to use: any
will go. In this case it is better to stick to the universal alias
"Microsoft.XMLHTTP", that covers anything from IE4 till now. If the
ajaxoid is really used for XML data handling then it may be important
to know what XMLHTTP version is available: or not important - it all
depends on what XML features and XPath commands are used."

and the post you are replying to:

"Again: just don't forget that is totally true only for ajaxoids
(XHRs) so for making new HTTP requests from the same page, grab the
server response and handle it manually.
For a real complex XML tasks the used version may be of a big
importance."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top