Search code examples
c#chmsandcastle

URLs to external links containing hash (#)


I'm creating a HTML Help 1 (chm) file for a C# project using Sandcastle and facing troubles with the generated chm file in such a way that URLs with hash (#) characters in them are not opening correctly in the browser when accessed.

What basically happens, is that anything after the hash in the URL is not present in the url when it is being opened in my browser. E.g:

having a link such as

http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//00250000089m000000

is shown as

http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html

in my browser.

Is there something that could be done in order bypass this limitation (which I am guessing is some kind of restriction)?


Solution

  • Space characters in the names of Help files are known to cause problems, at least as far as merged Help collections are concerned. Hash symbols (#) are a definite no-no in file and folder names, too, for the reasons outlined in this Microsoft Knowledge Base article:

    http://support.microsoft.com/?kbid=319247

    Many C# developers discovered that their documentation and e-books in CHM format cannot be read because they were storing their CHM files in the directories like 'C:\E-books\C#\' The hash character signifies an anchor in HTML so the CHM viewer fails to resolve the path properly and to retrieve the content.

    Solution: Remove the '#' (hash) character from the directory and file names. Also avoid using '?', '&', and '+' characters in directory names.

    Nevertheless I played a bit and was surprised. It seems a external link from a topic compiled into a CHM and opened in a new window 'target="blank"' is not working but a external link inside the browser pane of the CHM viewer is working.

    My CHM Build was created with Sandcastle Help File Builder and a second time with FAR HTML. A attached a snap.

    enter image description here

    enter image description here