Ugh, cross-origin iframes are the worst. To detect a click from iframe for specific div, you might need to rethink your approach.
If you can’t modify the iframe’s content, you’re pretty much out of luck due to security policies. But if you can, inject a script like this:
```js
document.getElementById('your-div').addEventListener('click', () => {
window.parent.postMessage('div-clicked', '*');
});
```
Then listen for it in the parent. Not perfect, but it works!
If you can’t modify the iframe’s content, you’re pretty much out of luck due to security policies. But if you can, inject a script like this:
```js
document.getElementById('your-div').addEventListener('click', () => {
window.parent.postMessage('div-clicked', '*');
});
```
Then listen for it in the parent. Not perfect, but it works!
