4

I am trying to embed OWA (Microsoft Exchange Server 2010) in a web page within an iframe but I get a JavaScript error on the OWA page saying Access Denied and then none of the controls within the OWA window work.

I have to use OWA in web page, I read in the form that cross domain does not work properly. Error comes as:

Client Information

User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.11) Gecko/20101012 Firefox/3.6.11 GTB7.1 (.NET CLR 3.5.30729)
CPU Class: undefined
Platform: Win32
System Language: undefined
User Language: en-US
CookieEnabled: true

Exception Details

Date: Wed Oct 27 2010 10:17:05 GMT+0530 (India Standard Time)
Message: Permission denied for <http://domain_2> to get property HTMLIFrameElement.ownerDocument from <domain_1>.
Url: http://domain_2/owa/testuser@exch2k10.com/14.0.639.21/scripts/premium/uglobal.js
Line: 1

Call Stack

undefinedError()@:0 window$onerror(&quot;Permission denied for <http://domain_2> to get property HTMLIFrameElement.ownerDocument from <domain_1>.&quot;,&quot;http://domain_2/owa/testuser@exch2k10.com/14.0.639.21/scripts/premium/uglobal.js&quot;,1)@http://domain_2/owa/testuser@exch2k10.com/14.0.639.21/scripts/premium/uglobal.js:1 (domain_1>.&quot;,&quot;http://domain_2/owa/testuser@exch2k10.com/14.0.639.21/scripts/premium/uglobal.js&quot;,1%29@http://domain_2/owa/testuser@exch2k10.com/14.0.639.21/scripts/premium/uglobal.js:1) function Array$get_Length() { return this.length; } function Array$get_Item(index) { return this[index]; } function Array$get_Enumerator() { return new (Owa.Collections.ListEnumerator)(this); } function Array$remove(oItem) { var index = this.indexOf(oItem); if (index > -1) { this.splice(index, 1); } return index > -1; } function Array$removeAt(iIndex) { if (iIndex < this.length) { this.splice(iIndex, 1); return true; } return false; } function Array$add(oItem) { this.push(oItem); } function Array$clone() {

What I saw is that the error comes when uglobal.js which comes with the Exchange in the iframe trying to access property of parent.

Message: Permission denied for <http://domain_2> to get property HTMLIFrameElement.ownerDocument from <domain_1>.

Is there any other way by which I can use OWA in my page?

icktoofay
  • 126,289
  • 21
  • 250
  • 231
R_Dhorawat
  • 141
  • 1
  • 1
  • 9
  • Same problem as http://stackoverflow.com/q/7995223/819417 – Cees Timmerman Apr 04 '14 at 16:30
  • @Cees: I agree that they both have the same underlying problem, but this question is about how to configure OWA to get around the problem, whereas that question is about how to avoid it in your own code. – icktoofay May 17 '14 at 06:23

3 Answers3

3

That's the cross domain policy restricting you. It's designed to prevent cross site scripting (XSS) attacks.

Basically, only pages from the same domain, protocol and port can alter each other's content.

Sasha
  • 544
  • 7
  • 5
2

I faced similar issues when trying to make cross domain calls. For IE8 you can use the following approach

var xdr = new XDomainRequest();
xdr.open("get", "http://domain2");
xdr.onload = function(){
    //your code
};
xdr.send();

Additionally in IE only for testing purposes there is an option to add the specific address (domain1 in your case) to the trusted list Tools>Security>Trusted Sites>Sites and allow it to make cross domain requests by going to custom level and selecting Access data sources across domains. Please ensure the second is used only for testing.

Philar
  • 3,887
  • 1
  • 24
  • 19
1

If no JSONP solution exists, build a server side proxy.

alex
  • 479,566
  • 201
  • 878
  • 984
  • can u tell me little bit more about server side proxy soln.. thanks for the reply – R_Dhorawat Oct 27 '10 at 06:48
  • @R_Dhorawat Use a server side language to request the file - then you can access it, or if you require client interaction - to serve it to your front end. – alex Oct 27 '10 at 11:03
  • client interaction is there so even if i get the required file once... problem will be still there. because if we click on some part of that frame there is other request will be there... – R_Dhorawat Oct 28 '10 at 05:14