访问属性'ownerDocument'的权限被拒绝

时间:2012-11-28 09:40:25

标签: jquery cross-domain

不可否认,这是一个令人讨厌的话题,但我完全陷入困境:

我正在尝试使用jquery autoheight插件(https://github.com/house9/jquery-iframe-auto-height)和jQuery v1.7将iframe的高度设置为其内容高度。

由于跨域问题,我构建了一个(curl-)包装器,所以一切都在同一个域上。 iframe的html标记如下所示:

<iframe scrolling="no" frameborder="0" src="/de/pressrelease/proxy/?uri=<my-uri>"></iframe>

Unfortunalty jquery吐出这个错误: [错误:访问属性'ownerDocument'的权限被拒绝]

我已经做了很多研究,例如检查了这个问题:Permission denied to access property in IFRAME

甚至尝试在iframe源中设置绝对uri - 同样的错误。

来自父文档的响应标头:

Date: Wed, 28 Nov 2012 09:42:11 GMT
Server: Apache
X-Powered-By: PHP/5.3.18-nmm1
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 3554
Keep-Alive: timeout=1, max=100
Connection: Keep-Alive
Content-Type: text/html

200 OK

来自curl-proxy-wrapper(iframe)的标题:

Date: Wed, 28 Nov 2012 09:42:07 GMT
Server: Apache
X-Powered-By: PHP/5.3.18-nmm1
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 4102
Keep-Alive: timeout=1, max=100
Connection: Keep-Alive
Content-Type: text/html

200 OK

1 个答案:

答案 0 :(得分:2)

对齐!发现问题了! document.domain设置为错误的域...