hans-georg1
(hans-georg gloeckler)
1
Is there a way to add an iFrame with pure java, like a Div, Span or Anchor.
I find it not under the following link:
https://vaadin.com/api/platform/12.0.3/com/vaadin/flow/component/HtmlContainer.html
But i find the code for iFrame on Gitthub under:
https://github.com/vaadin/flow/blob/master/flow-html-components/src/main/java/com/vaadin/flow/component/html/IFrame.java
I can not import it with:
import com.vaadin.flow.component.html.*;
ollit.1
(Olli Tietäväinen)
2
Martin.44
(Martin Israelsen)
4
Hans,
Here’s a very basic Iframe:
package bc.ui.components;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.HasSize;
import com.vaadin.flow.component.Tag;
@SuppressWarnings("serial")
@Tag("iframe")
public class Iframe extends Component implements HasSize {
public Iframe() {
}
public Iframe(String src) {
setSrc(src);
}
public void setSrc(String src) {
getElement().setProperty("src", src);
}
}
ollit.1
(Olli Tietäväinen)
5
Or you could also just copy-paste the class from GitHub, it doesn’t seem to have any dependencies.
hans-georg1
(hans-georg gloeckler)
6
When i try to add the code from GitHub all is ok, but i get one error at line
@Tag(Tag.IFRAME)
The error is
IFRAME cannot be resolved or is not a field
I try to make a workaround with
@Tag(value = "IFrame")
Now it works but i dont know if it is ok
When i use now this iFrame like in my other Posting here with “MIcroservice with iFrame”.
I have the same problem like there.
ollit.1
(Olli Tietäväinen)
7
@Tag("iframe")
should work at least.
Manali1
(Manali Kadam)
8
You can use HTML5 for this:
**<link rel="import" href="/path/to/file.html">**
hans-georg1
(hans-georg gloeckler)
9
Using HTML5 is ok
<link rel="import" href="/path/to/file.html">
But how can i include webside with HTML5 from extern
Something like
<link rel="import" href="http://www.google.com">