Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
How can I execute some JavaScript after a component becomes known to the DO
Hi Vaadin experts!
I have a BrowserFrame component, and I'm trying to react to its 'popstate' so that I can keep an eye on what the UI in there is doing.
In my UI.init, I use JavaScript.addFunction to add a server-side listener for the event and register it client-sde as 'function.name'. I then want to call the function from the BrowserFrame's iframe's 'popstate':
JavaScript.getCurrent().execute("document.getElementById('theIdOfTheBrowserFrame').contentWindow.window.onpopstate = function.name");
When can I do this? In init(), the component isn't in the DOM yet and so causes a JavaScript exception as the getElementById does not return a node. I tried moving the code into an AttachListener, but this doesn't work either.
Any help you can offer warmly received.
Thanks, Dan.