The things that we can do with iframes is that, we can manipulate things on the site in which iframe is used with Javascript’s contentWindow
and contentDocument
. Try these and see if they could help.
The
contentWindow
property returns the Window object of an
HTMLIFrameElement. You can use this Window object to access the
iframe’s document and its internal DOM. This attribute is read-only,
but its properties can be manipulated like the global Window object.
Using jQuery:
Use the jQuery contents() method
If you try to detect or capture a click
event inside an iframe simply using jQuery click() method it will not work, because iframe embed a web page within another web page. However, you can still do it on the same domain utilizing the jQuery contents()
and load()
method.
Try this resource: https://www.laravelcode.com/post/how-to-detect-click-inside-iframe-using-javascript