Enabling the Datajs Library on Windows Mobile

To enable the datajs-<version>.js library on Window Mobile 6.0 and Windows Mobile 6.1, you must add some custom code into the file where the Hybrid App is first launched.

For Windows Mobile 6.5, you need only to include the datajs-<version>.js library in your HTML file.

  1. Open the JavaScript file where the Hybrid App is first launched, for example, Custom.js, which is located in <SMP_HOME>\MobileSDK<version>\HybridApp\API\AppFramework.
  2. Add this code:
    ///Begin, This code enable datajs library on Windows 6.0 and Windows6.1 
    window.oldActiveXObject = window.ActiveXObject;
    window.ActiveXObject = function(id) {
    try{ return new window.oldActiveXObject(id); }
    catch (exception) {
    if(isWindowsMobile()){
    try{
    if(id == "Msxml2.XMLHTTP.6.0" || id == "Msxml2.XMLHTTP.3.0"){ return new window.oldActiveXObject("Microsoft.XMLHTTP"); }
    if(id == "Msxml2.DOMDocument.6.0" || id == "Msxml2.DOMDocument.3.0"){ return new window.oldActiveXObject("Microsoft.XMLDOM"); }
    }
    catch(e){ throw e; }
    }
    throw exception;
    }
    };
    //End
  3. Save the file.
  4. Rebuild the Hybrid App project.