Mostrar posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Amirshami

Paginas: [1]
1
Hey there,

A reliable way to wait for JavaFX2 WebEngine to load before executing JavaScript is by utilizing the WebEngine's getLoadWorker() method in conjunction with an event listener.

Here's a snippet of code to demonstrate:

Code: [Select]
WebEngine webEngine = webView.getEngine();
webEngine.getLoadWorker().stateProperty().addListener(
    (observable, oldState, newState) -> {
        if (newState == Worker.State.SUCCEEDED) {
            // Your JavaScript code here
        }
    }
);
webEngine.load("yourURL");
This code sets up a listener to wait for the SUCCEEDED state, indicating that the page has finished loading. Once that happens, your JavaScript code can be safely executed.

Hope this helps! Let me know on OGInstagram Apk if you have further questions.

Cheers,Amir_shami

Paginas: [1]