Monday 15 March 2010

javascript - how to link to an external file in sandcastle -


I am using the raincast and I have an external file that I want to provide a link with relative path . I have found an example that uses JavaScript to accomplish it, but the example does not work for me and I can set up a link for the external file of a CHM file through a relative path, Can not find the way Here I have seen an example that does not work for me ... I'm just pointing to another help file that I want to load. Instead of merging them into various reasons, I need to do this.

  & lt; ExternalLink & gt; & Lt; LinkText> Test & lt; / LinkText> & Lt; LinkAlternateText> Test & lt; / LinkAlternateText> & Lt; LinkUri & gt; Javascript: var thePage = unescape (window.location.href); Var start = thePage.indexOf (': \\') - 1; Var length = thePage.lastIndexOf ('.mmm)' - 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'; & Lt; / LinkUri & gt; & Lt; / ExternalLink & gt;   

Any help will be highly appreciated here!

Thank you.

I needed to add a target node which was re-targeted to the link on the current help window. Was:

  & lt; LinkTarget & gt; _self & lt; / LinkTarget & gt;   

Full work example:

  & lt; ExternalLink & gt; & Lt; LinkText> Test & lt; / LinkText> & Lt; LinkAlternateText> Test & lt; / LinkAlternateText> & Lt; LinkUri & gt; Javascript: var thePage = unescape (window.location.href); Var start = thePage.indexOf (': \\') - 1; Var length = thePage.lastIndexOf ('.mmm)' - 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'; & Lt; / LinkUri & gt; & Lt; LinkTarget & gt; _self & lt; / LinkTarget & gt; & Lt; / ExternalLink & gt; It has worked fine after adding   

... you get a pop-up notification to download / open the file, and it works from there. It would be nice to open it, but at the very least it works.

No comments:

Post a Comment