Java
- 1 ответ
- 0 вопросов
0
Вклад в тег
WebView webView = new WebView();
WebEngine webEngine = webView.getEngine();
webEngine.getLoadWorker().stateProperty().addListener(
( ov, oldState, newState) -> {
if (newState == Worker.State.SUCCEEDED) {
// all next classes are from org.w3c.dom domain
org.w3c.dom.events.EventListener listener = ( ev) -> {
System.out.println("#" + ev.getType());
};
org.w3c.dom.Document doc = webEngine.getDocument();
org.w3c.dom.Element el = doc.getElementById("mylink");
((org.w3c.dom.events.EventTarget) el).addEventListener("click", listener, false);
}
});
webEngine.loadContent("<a id='mylink' href='google.com'>hi</a>");