0

I am using sandcastle and I have an external file that I want to provide a link to with a relative path. I have found an example that uses javascript to accomplish this, but the example doesn't work for me and I can't find any other way to setup a link to an external file of a CHM file using a relative path. Here is the example I tried that doesn't work for me... I am simply pointing to another help file that I want to be loaded. I need to do this rather than merging them various reasons.

          <externalLink>
            <linkText>Test</linkText>
            <linkAlternateText>Test</linkAlternateText>
            <linkUri>
              javascript:
              var thePage = unescape(window.location.href);
              var start = thePage.indexOf(':\\') - 1;
              var length = thePage.lastIndexOf('.chm') - start;
              thePage = thePage.substr(start,length);
              length = thePage.lastIndexOf('\\') + 1;
              thePage = thePage.substr(0, length);
              window.location.href = thePage + '../../Test.Doc/Help/Test.Doc.chm';
            </linkUri>
          </externalLink>

Any help here would be greatly appreciated!

Thanks.

BotHead
  • 171
  • 1
  • 5

1 Answers1

0

I needed to add a target node that re-targeted the link at the current help window as follows:

      <linkTarget>_self</linkTarget>

Full working example:

      <externalLink>
        <linkText>Test</linkText>
        <linkAlternateText>Test</linkAlternateText>
        <linkUri>
          javascript:
          var thePage = unescape(window.location.href);
          var start = thePage.indexOf(':\\') - 1;
          var length = thePage.lastIndexOf('.chm') - start;
          thePage = thePage.substr(start,length);
          length = thePage.lastIndexOf('\\') + 1;
          thePage = thePage.substr(0, length);
          window.location.href = thePage + '../../Test.Doc/Help/Test.Doc.chm';
        </linkUri>
        <linkTarget>_self</linkTarget>
      </externalLink>

After adding that it worked fine... you get a pop-up notification to download/open the file, and it works from there. Would be nice to just have it open, but at the very least this works.

BotHead
  • 171
  • 1
  • 5