JavaFX webapp navigation interception & downloads

Matthieu BROUILLARD matthieu at
Fri Sep 19 13:18:31 UTC 2014

Hello all,

In the context of embedding/wrapping existing web applications in a Java
client, I am facing some issues especially in regard of navigation
interception & file download.
My first use case was to be able to navigate to PDFs exposed by a web

First I did not found a convenient API in JavaFX to register a kind of
"download plugin".

Then, I found that some people were monitoring webengine.location property.
This solution is very simple to setup but it fails when you want to
intercept several navigations to the same item.

Finally, I ended in investigating & demoing a way of doing it by using
javascript & java-javascript bridges possibilities.

I pushed my demo app to github:

What I do is:
- loading the webapp
- from java, inject a javascript lib
- from java, inject java bridges to this JS lib
- from JS, monitor the DOM
- on JS DOM modification, java bridges are called and install
'ClickListener' instances on appropriate JS DOM nodes (anchors in the
- when user click links, JS events are fired, handled by Java bridges, that
can then download the target of the link and consume the JS event
Do you think of easier way of doing this:
- in the current JavaFX version (8u20)?
- in future versions?

Several tickets are already opened, but I did not found any
target version for them, any info?

Thanks for feedback & keep on going with the great stuff you already

Matthieu Brouillard

More information about the openjfx-dev mailing list