Creating a Iframe that loads URL based on address on TextBox

Hi,

I just tried Vaadin today, and I am trying to figure out how to create a Iframe that loads URL. In my GWT application I just used the GWT frame component, however I am not sure how to implement this with Vaadin, and if it will work the same? Also, since the component is server side, does it mean that the iframe in a Vaadin application is not bound by browser SOP (policy)?

Cheers.
Xybrek

To load a remote URL in an iframe can be accomplished by using the Embedded component with and ExternalResource. There is in fact an example in the
Vaadin sampler
that does this. Basically, what you need to do, is to create an ExternalResource object with the URL from a TextField. After that you create an Embedded component and define it’s type as browser (this will tell the component to render itself as an iframe).

Embedded e = new Embedded("Vaadin web site", new ExternalResource(
                "http://vaadin.com"));
        e.setType(Embedded.TYPE_BROWSER);
        e.setWidth("100%");
        e.setHeight("400px");
        addComponent(e);

What comes to your question regarding the same origin policy - it depends. Vaadin consists of two side, a server side implementation and a client side implementation. The client side implementation is GWT code that is running your browser. This code is bound to SOP just like any other JavaScript. In other words, you cannot read content, cookies etc of an iframe, if it’s on another domain.