Posted 14 September 2017, 10:08 am EST
[activereports_archive]Hi Reema,
I don’t understand why that would help. The ajax requests are happening fine, the problem is the URL returned by the AJAX request that is being used in the iframe in the report viewer.
The short term solution we have been using is to intercept the creation of the iframe to make it point to the local rather than the absolute URL
like this
(function () {
function getLocalPath(url) {
var a = document.createElement('a');
a.href = url;
return a.pathname + a.search;
}
console.log("Monkey patching ");
var createElementUnpatched = document.createElement;
var correctIframeUri = function (iframe) {
console.log("Correcting url for iframe with src: " + iframe.src);
var oldSrc = iframe.src;
var newSrc = getLocalPath(oldSrc);
console.log("Replaced with " + newSrc);
iframe.src = newSrc;
};
var newCreateElement = function () {
console.log("intercepting create for " + arguments[0]);
var result = createElementUnpatched.apply(this, arguments);
if (arguments[0] === "iframe") {
setTimeout(function () { correctIframeUri(result) });
}
return result;
}
document.createElement = newCreateElement;
})();
Obviously we don’t want to use this in the long term as it is doing nasty stuff in the browser and could be very brittle to changes in the way that the reports are constructed by Active Reports.
The underlying problem is that an absolute URL is being returned from the GetExportedReportLink method.
Kind regards,
Leo
[/activereports_archive]