Copy link to clipboard
Copied
Hi All,
I've done some searching and have the start of this. Per Subject, I would like to link to a provided index.htm file that is included in the release CHM directory. I searched the forum and found the following:
describes the JS to get the relative URL
So here is what I tried. I created a script in the RH2019.Patch9 project.
function
URL_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;
}
Then I simply added a Button1 URL as follows:
<a onclick="URL_Parser('index.htm')" style="text-decoration: underline; color: green; cursor: hand">Link to QSG</a>
However, this does not work.
Searching a bit, someone recommended keeping the script right inside the HTM page.
So I did a test link by adding the following to the bottom of my file:
<script language="JScript">
//<![CDATA[
function URL_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><a onclick="URL_Parser('index.htm')" style="text-decoration: underline;color:green;cursor: hand">Link to QSG</a></p>
And this worked per the figure.
So what do I need to do to get this to kick off from the button?
thanks.
Copy link to clipboard
Copied
Hi there
I'm wondering if the answer here will be to simply configure the CHM Button 1 to display that page where you have the button. Then configure that page with an OnLoad statement that does the same thing that button press does.
I'm thinking it might look something like this in the HTML:
<body onLoad="URL_Parser('index.htm')">
If this works, the user would click the button in the CHM toolbar, the page would load into the CHM window, the OnLoad statement would trigger and cause the external page to load outside the CHM. A bit of a set of dominos!
Cheers... Rick 🙂
Copy link to clipboard
Copied
OK thanks will try. Before I do, do I place the script in the script folder like this?
Note my script name in RH is SC_URL_Parser. Does it need to be the same as the function name?
Copy link to clipboard
Copied
Copy link to clipboard
Copied