Web Analytics Made Easy -
StatCounter XMLHttpRequest() in IE for Pocket PC? - CodingForum


No announcement yet.

XMLHttpRequest() in IE for Pocket PC?

  • Filter
  • Time
  • Show
Clear All
new posts

  • XMLHttpRequest() in IE for Pocket PC?

    I'm attempting to get a page working on IE6 for Pocket PC (not PIE). This page uses an XMLHttpRequest() object to regularly update information from an embedded perl program. This page works perfect in every other browser, but IE6PPC claims it does not know the object. I'm finding conflicting reports from MSDN's libraries, some claiming that it should still have XMLHttpRequest() (though not the server side version). Other documents claim it has very little to no support for such features.

    To double check, I navigated to Google Suggest and found it to be working perfectly, so I know there has to be a way. However, the standard code does not work (and throws an error when it reaches XMLHttpRequest:

     /*@cc_on @*/ 	 
     /*@if (@_jscript_version >= 5) 	 
     // JScript gives us Conditional compilation, we can cope with old IE versions. 	 
     // and security blocked creation of the objects. 	 
      try { 	 
       xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 	 
      } catch (e) { 	 
       try { 	 
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 	 
       } catch (E) { 	 
        xmlhttp = false; 	 
     @end @*/
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
      try{xmlhttp = new XMLHttpRequest();}catch(e){}

    Does anyone have experience with this? Because I am stumped.

  • #2
    IT might be looking for the really old identifeication of the object:


    Though it seems to me that it should be able to derive the 4.0 without it being explict. However some of the early suppor in IE browsers did require the whole thing.
    100% standards compliant code is 100% correct 100% of the time.



    • #3
      This may work...

      // Get XML Http object
      function GetXMLHttpObject()
      	// IE
      	// store proper progIDs
      	_DOM_PROGID = pickRecentProgID(["Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XmlDom"]);
      	_XMLHTTP_PROGID = pickRecentProgID(["Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]);
      	// we dont need this anymore
      	pickRecentProgID = null;
      	//alert( _XMLHTTP_PROGID );
      	if ( document.all )
      		//return new ActiveXObject( "Msxml2.XMLHTTP" );
      		return new ActiveXObject( _XMLHTTP_PROGID );
      	// NS
      		return new XMLHttpRequest();
      function pickRecentProgID(idList)
      	// found progID flag
      	var bFound = false;
      	for (var i=0; i < idList.length && !bFound; i++)
      			var oDoc = new ActiveXObject(idList[i]);
      			o2Store = idList[i];
      			bFound = true;
      		catch (objException)
      			// trap; try next progID
      	if (!bFound)
      		throw "Exception: Could not retreive a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")";
      	idList = null;
      	return o2Store;