Propagating mouse events from iframes to the hosting document

痞子三分冷 提交于 2019-12-23 10:13:38

问题


I have an iframe covering the entire HTML document, and I'd like to propagate clicks and hover events back to the hosting document.

What are my options?


回答1:


I was asked to look into this several weeks ago for a project. It's possible to do it, and there's a working example of it in action here:

http://www.esqsoft.com/javascript_examples/iframe_talks_to_parent/

However, the crucial thing to bear in mind is that unless the parent and child are on the same domain, it's not possible to have events passed between them. If your iframe contains a page from a different domain then you're out of luck, I think.



来源:https://stackoverflow.com/questions/5693582/propagating-mouse-events-from-iframes-to-the-hosting-document

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!