fs banner

How to link a PDF file in CHM files?

Here is a piece of code for opening a PDF file directly inside a CHM file provided by Sjoerd B. Franken.

Include this script in the HEAD tag
<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>

Then link this way
<a onclick="parser('Your_PDF_File.pdf')" style="text-decoration: underline;
color: green; cursor: hand">Click ME Please!</a>

Notes:
The PDF file must be distributed together with the CHM file and they must be in the same directory.

Return to topReturn to top


Copyright © 2016 Fly Sky Software,Inc. All Rights Reserved.