ExecuteJS() not working even after page is fully loaded

Welcome! Forums Unity Plugins In-App Web Browser ExecuteJS() not working even after page is fully loaded

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #23071
    Andrea88
    Participant

    Hi,
    I’m currently trying to get JavaScript communication working using your plugin, but I’m facing a blocking issue: the InAppBrowser.ExecuteJS() call doesn’t seem to execute any code inside the WebView.

    Here’s a full recap of what I’ve tried and confirmed:

    What works:
    Communication from JS to Unity using window.Unity.call() works as expected.

    The onJSCallback in Unity correctly receives the message (e.g. “ping”).

    I also receive the onBrowserFinishedLoading event properly.

    What doesn’t work:
    The method InAppBrowser.ExecuteJS(“alert(‘pong!’)”); never triggers any visible JS behavior (no alert, no console.log, no DOM change).

    I’ve tried placing the JS execution inside the onBrowserFinishedLoading callback, like this:

    bridge.onBrowserFinishedLoading.AddListener((string url) => {
    Debug.Log(“Browser finished loading: ” + url);
    InAppBrowser.ExecuteJS(“alert(‘pong!’)”);
    });
    I also tried injecting JS that modifies the DOM (changing document.body.innerHTML), but again, no result.

    I added the proper network_security_config and allowed cleartext traffic (android:usesCleartextTraffic=”true”), directly customizing the manifest, cause i have thinked about HTTPS security protocol… but even with this, no JS execution.

    I have tested on Android Xiaomi 9T pro and in a Nothing phone 2A. In Xiaomi i can clairly see on android logcat : 2025/06/11 17:16:08.278 15376 15376 Warn ContentCatcher Failed to notify a WebView!

    Thanks for the support

    #23072
    PiotrPiotr
    Keymaster

    Hi,
    It would be best to debug it directly on a device. If I give you access to github project is it something you could try by yourself?

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.