Skip to content Skip to sidebar Skip to footer

How To Add Multiple Html Pages To The Same Webview

I'm trying to load multiple HTML pages into a JavaFx WebView from Java, but I only get the last added WebView added: .java file private void multiplePages() { webEngine.load('f

Solution 1:

A single WebView instance can only view a single HTML document at any given time.

Maybe you are would like to use an iframe, which would allow you to embed multiple HTML pages within a single HTML page? Though, in modern HTML development, use of iframes is often discouraged for many tasks as it has numerous drawbacks.

The standard way to achieve a header and body for a HTML page would be to use a templating language for HTML generation to compose multiple HTML fragments into a single HTML page. HTML templates are a subject that is too broad in scope of a StackOverflow answer. Composition of HTML templates can range in complexity from simple string appending to use of complicated processing technologies such as JSF. You may wish to research HTML templating separately.

Post a Comment for "How To Add Multiple Html Pages To The Same Webview"