title: JavaFX WebView HyperLinks Cannot Be Disabled on Mobile Devices
body: <p>The below code is used to disable hyperlinks in a JavaFX WebView object. However, when I run it on a mobile device it does not work, whilst it is working OK on desktop. Any alternative solution to affect mobile devices?</p>
  
  <pre><code>private void init() {
      webEngine = webView.getEngine();
      webEngine.getLoadWorker().stateProperty().addListener((ov, oldState, newState) -&gt; {
        if(newState == State.SUCCEEDED &amp;&amp; webEngine.getDocument() != null)
          disableHyperLinks(webEngine.getDocument());
      });
  } // init()
  
  private void disableHyperLinks(Document document) {
      NodeList nodeList = document.getElementsByTagName("a");
      for (int i = 0; i &lt; nodeList.getLength(); i++)
      {
            Node node= nodeList.item(i);
            EventTarget eventTarget = (EventTarget) node;
            eventTarget.addEventListener("click", (evt) -&gt; {
              evt.preventDefault();
            }, false);
      } // for
  } // disableHyperLinks()
  </code></pre>