Index: trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java	(revision 13456)
+++ trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java	(revision 13457)
@@ -18,4 +18,6 @@
 import java.nio.charset.StandardCharsets;
 import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import javax.swing.AbstractAction;
@@ -617,6 +619,7 @@
                 return null;
             String s = (String) value;
-            if (s.matches("#.*"))
-                return s.substring(1);
+            Matcher m = Pattern.compile("(?:"+url+")?#(.+)").matcher(s);
+            if (m.matches())
+                return m.group(1);
             return null;
         }
@@ -639,5 +642,5 @@
                 } else {
                     HelpAwareOptionPane.showOptionDialog(
-                            Main.parent,
+                            instance,
                             tr("Failed to open help page. The target URL is empty."),
                             tr("Failed to open help page"),
