Use id inside browserframe vaadin 7

Hi,

I have a question, I use the component browserframe who content another site (externalressource).
I want interact with this site but it doesn’t work.

To do, i use javascript and i want put the text color of login in blue. So inplogin is id of the another site.

JavaScript.getCurrent().execute("document.getElementById('browserframe').getElementById('inplogin').style.color = 'blue';");

It doesn’t work, i have error in console.

JavaScript.getCurrent().execute("document.getElementById('tt').style.color = 'blue';");

It work.

BrowserFrame browserFrame = new BrowserFrame("",new ExternalResource("..."));
browserFrame.setSizeFull();
browserFrame.setId("browserframe");
setSizeFull();
TextField t = new TextField("test");
t.setId("tt");
addComponents(t,browserFrame);

So can we with Vaadin 7 use or manipulate dom (id) inside browserframe

Best regard

JavaScript can’t access <iframe> (BrowserFrame) contents unless the content is served from the same domain. It’s a browser security restriction, not related to Vaadin.

Ok, but can we use Vaadin and not JS to interact (manipulate DOM) with iframe (BrowserFrame). Maybe Vaadin 16 ?

Nope, unless you’re creating the content inside the iframe with another Vaadin app and you’re communicating with that other app somehow. Vaadin versions won’t really make a difference here. See more here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe