I’m using Ionic 4, and launching a Google Map in an iframe. The map has a bunch of markers on it, and when the user clicks a marker it fires a javascript event in that iframe.
Is there some clever way to get details about what they clicked? I’m trying to get their chosen location.
No, there’s no way to access data inside a cross-origin iframe except if the iframe uses postMessage(). If you control that iframe, that’s a completely different story, you can do whatever you want then. If it’s the same origin, you can traverse between window objects. If it’s not the same origin, you can use postMessage inside the iframe to emit data
Yes that would be a cross-origin situation, but what you can do then is handle those events in your iframe, then emit them using postMessage. Then, in your parent window (i.e. your app) you can use