Linking from CHM with standard HTML

This is a simple sample how to link from a compiled CHM to HTML files. Some files are on a web server some are local and relative to the CHM file.

How to link relative to a HTML file that isn't compiled into the CHM

The following technique of linking is useful if one permanently must update some files on the PC of the customer without compiling the CHM again. The external file must reside in the CHM folder or a subfolder.

Link relative to a external HTML file (external_files/external_topic.htm)

Link code:

<p>
<SCRIPT Language="JScript">
function parser(fn) {
 var X, Y, sl, a, ra, link;
 ra = /:/;
 a = location.href.search(ra);
 if (a == 2)
  X = 14;
 else
  X = 7;
  sl = "\\";
  Y = location.href.lastIndexOf(sl) + 1;
  link = 'file:///' + location.href.substring(X, Y) + fn;
  location.href = link;
 }
</SCRIPT>
</p>

<p>
  <a onclick="parser('./external_files/external_topic.htm')"
  style="text-decoration: underline;
  color: green; cursor: hand">Link relative to a external HTML file (external_files/external_topic.htm)</a>
</p>

 


How to link to a topic in another CHM file

Link to topic

Problem: When the user clicks an ms-its jump that includes a target in another CHM file, the topic appears at the correct target location, but the css styles are not applied and the graphics do not appear. Clicking refresh loads the graphics and styles.
Here's an example jump:
<A href="ms-its:filename.chm::html/TroubleShooting.htm#checklist">

You can work around the css problem by referencing the css in the <head> section of the HTML file using the ms-its protocol but that doesn't fix the graphic issue.
The solution is to replace "ms-its:" with the older "mk:@MSITStore:" scheme.

How to link to HTML pages on the web

 In the past, energy was won with windmills in Germany. Windmill, Germany - Ditzum

See more information about mills (click the link).

Modern information (link):                               http://en.wikipedia.org/wiki/Wind_turbine

Modern information (link - with bookmark):         http://en.wikipedia.org/wiki/Wind_turbine#History

Modern information (link - in new window):        http://en.wikipedia.org/wiki/Wind_turbine

 

 

back to top ...