Skip to main content
March 24, 2013
Question

Need assistance with JavaScipt page reference

  • March 24, 2013
  • 1 reply
  • 756 views

[RH10, WebHelp Pro]

Hello,

A couple of years ago, someone here kindly provided a script that we use to give our users a feedback e-mail link from any page in the published output. We want to improve the script so that it returns a link not just to the specific page, but to the specific page PLUS the TOC pane.

Currently, the script defines a variable:

var str = location.href

The resulting link is:

http://projectname/robohelp/robo/server/general/projects/projectname/pagename.htm

What modification to the variable or the script is required to produce this link instead:

http://projectname/robohelp/robo/server/general/projects/projectname/default page#pagename.htm

The intention being that the added default page and hash mark would cause the link to open the page in the complete default frameset rather than just the page without the TOC?

Thank you

This topic has been closed for replies.

1 reply

Willam van Weelden
Inspiring
March 25, 2013

Hi,

Check this script, this returns exactly that string: Get the CSH URL of a topic: http://www.wvanweelden.eu/blog/2012/08/03/get-csh-url-topic

Also, see Peter's site: http://www.grainge.org/pages/snippets/mailto.htm

Greet,

Willam

March 25, 2013

It appears the script we are using is a variant of the one you linked to on Peter's site. It works well and  Javascript-wise, I don't feel competent to replace it.

Is it not possible simply to insert an additional parameter to the location.href variable so that it captures the default frameset as well as the page name?

Willam van Weelden
Inspiring
March 26, 2013

You can get the default frameset by

top.location.href

But that doesn't get the URL you want.

The function I linked to does just that. Instead of the document.location statement, reference the function:

var str=CSHURL();

And add the function CSHURL() to the master page or put it in a separate file and link that to your topics.

Greet,

Willam