How to detect a click from iframe for specific div? Alternatively, for a bit more context: Best way t

16 Replies, 1663 Views

Title: How to detect a click from iframe for specific div?

Hey folks,

Struggling to detect a click from iframe for specific div. The iframe loads external content, and I need to know when a particular div inside it is clicked.

Tried `contentWindow` and `postMessage`, but no luck. Is there a cleaner way? Or am I missing something obvious?

Also, cross-origin issues are a pain. Any workarounds?

Thanks in advance!

---

Title: Best way to detect a click from iframe for specific div?

Anyone nailed this?

I need to detect a click from iframe for specific div, but the usual event listeners don’t fire. Tried bubbling events, but nada.

Is there a modern JS hack or library that handles this smoothly?

Cross-origin is blocking me too. Help a dev out!

---

Title: Why can't I detect a click from iframe for specific div?

So frustrating!

Trying to detect a click from iframe for specific div, but it’s like the events vanish. Even with `window.addEventListener`, nothing.

Is this a security thing? Or am I just coding it wrong?

Any tips or fixes? Cheers!

Messages In This Thread
How to detect a click from iframe for specific div? Alternatively, for a bit more context: Best way t - by - 09-10-2024, 01:10 AM



Users browsing this thread: 1 Guest(s)