diff --git a/src/main/java/net/rptools/maptool/client/MapTool.java b/src/main/java/net/rptools/maptool/client/MapTool.java index 91e8b01391..68e3cd98f3 100644 --- a/src/main/java/net/rptools/maptool/client/MapTool.java +++ b/src/main/java/net/rptools/maptool/client/MapTool.java @@ -480,11 +480,15 @@ public static BackupManager getBackupManager() { * be called from any uncontrolled macros as there are both security and denial-of-service attacks * possible. * + *

This should not be called from any uncontrolled macros as there are both security and + * denial-of-service attacks possible. + * + *

This must be called on the AWT thread. + * * @param url the URL to pass to the browser. */ public static void showDocument(String url) { - if (Desktop.isDesktopSupported()) { - String lowerCaseUrl = url.toLowerCase(); + if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { String urlToBrowse = url; Desktop desktop = Desktop.getDesktop(); URI uri = null; @@ -492,8 +496,8 @@ public static void showDocument(String url) { uri = new URI(urlToBrowse); if (uri.getScheme() == null) { urlToBrowse = "https://" + urlToBrowse; + uri = new URI(urlToBrowse); } - uri = new URI(urlToBrowse); desktop.browse(uri); } catch (Exception e) { MapTool.showError(I18N.getText("msg.error.browser.cannotStart", uri), e); diff --git a/src/main/java/net/rptools/maptool/client/ui/htmlframe/HTMLWebViewManager.java b/src/main/java/net/rptools/maptool/client/ui/htmlframe/HTMLWebViewManager.java index 7f4becc55a..1e2fdbb421 100644 --- a/src/main/java/net/rptools/maptool/client/ui/htmlframe/HTMLWebViewManager.java +++ b/src/main/java/net/rptools/maptool/client/ui/htmlframe/HTMLWebViewManager.java @@ -585,8 +585,8 @@ private void fixHref(org.w3c.dom.events.Event event) { // Java bug JDK-8199014 workaround webEngine.executeScript(String.format(SCRIPT_ANCHOR, href.substring(1))); } else if (!href2.startsWith("javascript")) { - // non-macrolink, non-anchor link, non-javascript code - MapTool.showDocument(href); // show in usual browser + // non-macrolink, non-anchor link, non-javascript code. Show in usual browser + SwingUtilities.invokeLater(() -> MapTool.showDocument(href)); } event.preventDefault(); // don't change webview }