2

I've been trying to implement AngularJS v1.3 on an Ektron v8.7 site, and I've hit a rather strange roadblock.

When an Ektron server control (in this case, a FormBlock) is on the page, extra javascript is injected into the page. One of these javascript files is Ektron.Xml.js. My page uses AngularJS to make AJAX web service calls, and all this works fine in Chrome, Firefox, and IE 11. However, the AJAX calls fail to even send when I'm using AngularJS v1.3 and IE 10 or below. It works, though, if I target v1.2 of AngularJS. It also works with v1.3 of AngularJS if I remove the Ektron server controls from the page.

Here's what I found. First, there is a difference in AngularJS between v1.2 and v1.3 in how Angular creates the XMLHttpRequest object in httpBackend.js:

AngularJS v1.3 (https://github.com/angular/angular.js/blob/g3_v1_3/src/ng/httpBackend.js)

function createXhr() {
    return new window.XMLHttpRequest();
}

AngularJS v1.2 (https://github.com/angular/angular.js/blob/g3_v1_2/src/ng/httpBackend.js)

function createXhr(method) {
    //if IE and the method is not RFC2616 compliant, or if XMLHttpRequest
    //is not available, try getting an ActiveXObject. Otherwise, use XMLHttpRequest
    //if it is available
    if (msie <= 8 && (!method.match(/^(get|post|head|put|delete|options)$/i) ||
      !window.XMLHttpRequest)) {
      return new window.ActiveXObject("Microsoft.XMLHTTP");
    } else if (window.XMLHttpRequest) {
      return new window.XMLHttpRequest();
    }

    throw minErr('$httpBackend')('noxhr', "This browser does not support XMLHttpRequest.");
}

Second, one of Ektron's files appears to be changing the constructor for the XmlHttpRequest object.

/WorkArea/FrameworkUI/js/Ektron/Ektron.Xml.js, starting at line #1274

// IE initialization
if (Sarissa._SARISSA_IS_IE) {

    // some code omitted for brevity...

    XMLHttpRequest = function () {
        if (!_SARISSA_XMLHTTP_PROGID) {
            _SARISSA_XMLHTTP_PROGID = Sarissa.pickRecentProgID(["Msxml2.XMLHTTP.6.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]);
        }
        return new ActiveXObject(_SARISSA_XMLHTTP_PROGID);
    };

    // ...

}

From what I can tell, this Sarissa._SARISSA_IS_IE property seems to not recognize IE 11. This bug seems to confirm my suspicion: http://sourceforge.net/p/sarissa/bugs/63/

From the comments in the js file, it appears to include version 0.9.9.4 of Sarissa.

So my question is: Is there anything I can do here? Do newer versions of Ektron still do the same thing? Is this a matter of Ektron needing to include a more recent version of Sarissa? Can I do anything to make AngularJS v1.3 work with Ektron v8.7's server controls?

Brian Oliver
  • 1,407
  • 2
  • 15
  • 25
  • Similar but to our issue, but with Ektron. http://salesforce.stackexchange.com/questions/13648/salesforce-xmlhttprequest-on-ie10 – Jon Price Jan 14 '15 at 14:00

0 Answers0