Cross domain access to iframe using window.name

2019-07-17 02:03发布

I implemented a script that monitors the iframe name as I understood was OK from various sources on the net. However it seems I must have gotten something wrong - I get

Error: Permission denied to access property 'name'
Source File: http://plungjan.name/test/testwindowname.html
Line: 16

Please visit http://plungjan.name/test/testwindowname.html

I would prefer just to fix my script and not use jQuery or DOJO or some other framework. Thanks

3条回答
forever°为你锁心
2楼-- · 2019-07-17 02:26

as I remember you must change iframe location to "about:blank" and after it you can access to its window.name property

查看更多
Emotional °昔
3楼-- · 2019-07-17 02:31

Is it cross-domain communication you need here, or just the name of the window?

If the first one, take a look at easyXDM - it abstracts away all the hassle with XDM across browsers ranging from IE6 to Chrome10.

查看更多
对你真心纯属浪费
4楼-- · 2019-07-17 02:34

Take a look at this question:

Resizing an iframe based on content

Has a Cross Domain solution ... but you need to have access to both the servers to implement this solution.

查看更多
登录 后发表回答