asp.net jquery在子域中的iframe中访问对象

时间:2017-03-08 13:06:09

标签: javascript jquery asp.net iframe cross-domain

我有3个应用程序在同一服务器上运行app1.corp.local,app2.corp.local,app3.corp.local

app1在iframe中打开app2.corp.local。我已经设定了

<script>
document.domain = 'corp.local'
</script>

我想从app1.corp.local上的页面访问位于iframe的app2.corp.local中的对象。

虽然我已经设置了document.domain =&#39; corp.local&#39;我得到了

Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http://app1.corp.local" from accessing a cross-origin frame.
    at contents (http://app1.corp.local/Scripts/jquery-2.1.3.min.js:2:26363)
    at Function.map (http://app1.corp.local/Scripts/jquery-2.1.3.min.js:2:3485)
    at n.fn.init.n.fn.(anonymous function) [as contents] (http://app1.corp.local/Scripts/jquery-2.1.3.min.js:2:26452)
    at Object.success (http://app1.corp.local/App1:31:38)
    at j (http://app1.corp.local/Scripts/jquery-2.1.3.min.js:2:26911)
    at Object.fireWith [as resolveWith] (http://app1.corp.local/Scripts/jquery-2.1.3.min.js:2:27724)
    at x (http://app1.corp.local/Scripts/jquery-2.1.3.min.js:4:11065)
    at XMLHttpRequest.<anonymous> (http://app1.corp.local/Scripts/jquery-2.1.3.min.js:4:14577)

这可能是什么解决方案。?

任何帮助都将不胜感激。!!

- 感谢

0 个答案:

没有答案