I want to catch clicks that occur anywhere in an iframe. I can not directly access the iframe because it contains content from another domain. So how would I do that with jQuery? Somehow calculate if the click occurred in the area of the iframe? The iframe should stay totally accessible as it contains links etc.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- jQuery add and remove delay
This is impossible due to the Same origin policy. jQuery cannot magically circumvent the browser environment.
You may wish to implement a same-domain proxy (example in php) that passes the target site's html through to your iframe. You didn't mention what server-side technology you are using so I cannot be more specific.