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.
Vaadin cross-origin frame issue
Hi
How do you solve the issue with cross-origin frame issue in Vaadin. I am trying to use BrowserFrame and I think this creates an iframe and does not allow to access the site. It says:
Blocked a frame with origin " " from accessing a cross-origin frame.
Is there any workaround for this?
Same-origin policy is a security constraint of browsers. Without it there could be huge security problems. There isn't a direct workaround, the actual implementation depends on what you are actually trying to archieve.
For more info, I recommend, for example, checking out either this, this or this StrackOverFlow thread.
Hi Tapio,
Thanks for your response. I am trying to use Vaadin's BrowserFrame and display the content of the external site. However, I cannot do so, because of this "same-origin policy."
Can we embed applications made in AngularJS, JS and others inside Vaadin application? I don't think it is so trivial with the framework.
Well, you can embed anything inside a Vaadin app using an iFrame if you follow the security rules. But naturally you'll get problems if you want to communicate with the 'others'. And that depends on the case.
Do you have some kind of example, or even a project, that you could post here? It differs a lot from case-to-case how the embedding should actually be done.
I am using new Vaadin Designer and trying to communicate with this 'other' site.
Here is the code of mydesign.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" name="design-properties" content="{"RULERS_VISIBLE":true,"GUIDELINES_VISIBLE":true,"SNAP_TO_OBJECTS":true,"SNAP_TO_GRID":true,"SNAPPING_DISTANCE":10,"PAPER_WIDTH":768,"PAPER_HEIGHT":1015,"PAPER_SCROLL_LEFT":2190,"PAPER_SCROLL_TOP":1750,"JAVA_SOURCES_ROOT":"src","THEME":"sampledatasetproject"}">
</head>
<body>
<v-css-layout size-full="true">
<v-menu-bar responsive="true" width-full="true" plain-text=""></v-menu-bar>
<v-horizontal-split-panel height="987px" split-position="19.791666%">
<v-css-layout size-full="true">
<v-button style-name="link" plain-text="" _id="ds123456">
ds123456
</v-button>
<v-button style-name="link" plain-text="" _id="dss12345">
dss12345
</v-button>
<v-button style-name="link" plain-text="" _id="testButton">
test button
</v-button>
</v-css-layout>
<v-panel size-full="true">
<v-browser-frame source="https://dev.example.local/wwwwwcgi/wwwwwgui?html=/usr/lib/example/www/templates/custom_reports/fpf_database.wwwwwwgui&gpdatabase=exampledemo&gpreportfile=fpf_database.wwwwwwgui&gppersonid=&gpdbname=&gpbcard=mother" width-full="true" height="98.99%"></v-browser-frame>
</v-panel>
</v-horizontal-split-panel>
</v-css-layout>
</body>
</html>
Here is the code for MyDesign.java
/**
* !! DO NOT EDIT THIS FILE !!
*
* This class is generated by Vaadin Designer and will be overwritten.
*
* Please make a subclass with logic and additional interfaces as needed,
* e.g class LoginView extends LoginDesign implements View { … }
*/
@DesignRoot
@AutoGenerated
@SuppressWarnings("serial")
public class MyDesign extends CssLayout {
protected Button ds123456;
protected Button dss12345;
protected Button testButton;
public MyDesign() {
Design.read(this);
}
}