Create "Open topic with navigation" link on toolbar
Create "Open topic with navigation" link on toolbar
Hi
I'd like to be able to add a custom toolbar button which would grab the full link to the current topic being viewed. This would be exactly the same link as is generated for the "Open topic with navigation" link (but of course this doesn't get displayed when viewing with navigation!).
Anyone know how I can do this please? The idea is that we can then easily refer customers to specific pages by sending them the link (but with navigation).
thanks
Richard
I'd like to be able to add a custom toolbar button which would grab the full link to the current topic being viewed. This would be exactly the same link as is generated for the "Open topic with navigation" link (but of course this doesn't get displayed when viewing with navigation!).
Anyone know how I can do this please? The idea is that we can then easily refer customers to specific pages by sending them the link (but with navigation).
thanks
Richard
---
Using Flare 7.0
Using Flare 7.0
Re: Create "Open topic with navigation" link on toolbar
It's easy to get a full link to the current topic being viewed; but that isn't actually the same as the link used for 'open topic with navigation', as that uses a CSH link.
For example, to get the link to the current topic, use the following OnClick action:
That'll put the URL in a prompt, so you can copy and paste the link.
However, to replicate the open topic with navigation link, you'd need to use some javascript to modify that URL into a CSH link.
For example, the URL might look like this:
www.yoursite.com/help/content/topic.htm
But you would need to modify that to make it a CSH call, adding the topic (and path) after the #:
www.yoursite.com/help/default_CSH.htm#topic.htm
For example, to get the link to the current topic, use the following OnClick action:
Code: Select all
prompt("Address:", parent.frames["body"].location.href);However, to replicate the open topic with navigation link, you'd need to use some javascript to modify that URL into a CSH link.
For example, the URL might look like this:
www.yoursite.com/help/content/topic.htm
But you would need to modify that to make it a CSH call, adding the topic (and path) after the #:
www.yoursite.com/help/default_CSH.htm#topic.htm
Re: Create "Open topic with navigation" link on toolbar
Hi - thanks for the quick reply.
I agree - easy to get the current topic url. Any chance you could post the javascript required to get the full CSH link?
I might actually send this in as a feature request - sure it would be useful / have seen this on other help systems (e.g. Xero Help - see the link button next to their search box.)
thanks
I agree - easy to get the current topic url. Any chance you could post the javascript required to get the full CSH link?
I might actually send this in as a feature request - sure it would be useful / have seen this on other help systems (e.g. Xero Help - see the link button next to their search box.)
thanks
---
Using Flare 7.0
Using Flare 7.0
Re: Create "Open topic with navigation" link on toolbar
This is a rough and ready script that works for me, you might want to refine it:
I'm not going to start getting into it; I'd suggest reading up on javascript to understand how to manipulate strings - http://www.w3schools.com/jsref/jsref_obj_string.asp
Code: Select all
var link = parent.frames["body"].location.href; prompt("Address:", link.replace("Content/","default_CSH.htm#"));Re: Create "Open topic with navigation" link on toolbar
thanks very much - that works great for me!
---
Using Flare 7.0
Using Flare 7.0
Re: Create "Open topic with navigation" link on toolbar
Dave, thanks for the info; this is really useful.
One request: Is there some way to do this that doesn't use the prompt command? Our users are internal to the company, and the company uses Internet Explorer. As I understand it, IE version 7 and up warns users that the page wants to run a script before it'll open it, which I can't expect our users to do every time they want to access our help.
One request: Is there some way to do this that doesn't use the prompt command? Our users are internal to the company, and the company uses Internet Explorer. As I understand it, IE version 7 and up warns users that the page wants to run a script before it'll open it, which I can't expect our users to do every time they want to access our help.
Re: Create "Open topic with navigation" link on toolbar
Whether you get a warning depends on where you are running the help from, and your security settings.Bahbert wrote:Dave, thanks for the info; this is really useful.
One request: Is there some way to do this that doesn't use the prompt command? Our users are internal to the company, and the company uses Internet Explorer. As I understand it, IE version 7 and up warns users that the page wants to run a script before it'll open it, which I can't expect our users to do every time they want to access our help.
You'll get a warning if you're running the WebHelp locally when you have MOTW enabled. If you don't use MOTW (which means security warnings when you open the help), then you don't get a warning for this prompt. I don't think you get any warnings if your help is on a webserver.
What other methods of displaying this were you thinking about?
If you display it as an alert (an 'ok' prompt), you can't select and copy the text.
If you try and copy it to the clipboard in the script, browsers seem to block that.
Re: Create "Open topic with navigation" link on toolbar
Ah, I'd forgotten about MOTW.
Guess I'm just looking for a more elegant solution. The prompt box that Explorer puts up is kind of, well, ugly. I'll keep looking, but this has been a great place for me to start. Thanks again.
Guess I'm just looking for a more elegant solution. The prompt box that Explorer puts up is kind of, well, ugly. I'll keep looking, but this has been a great place for me to start. Thanks again.
Re: Create "Open topic with navigation" link on toolbar
Please update this thread if you do find an elegant solution! I'm not keen on the standard dialog boxes either.
I'd love to be able to do it the way that the Xero Help Centre does (check the link button just to the right of search).
I'd love to be able to do it the way that the Xero Help Centre does (check the link button just to the right of search).
---
Using Flare 7.0
Using Flare 7.0
Re: Create "Open topic with navigation" link on toolbar
Yep, that example is nice (and the help itself looks nice); we're getting a bit into scripting here though, I would imagine there's a few scripts online that do something similar and could be adapted.le_sloth wrote:Please update this thread if you do find an elegant solution! I'm not keen on the standard dialog boxes either.
I'd love to be able to do it the way that the Xero Help Centre does (check the link button just to the right of search).
Re: Create "Open topic with navigation" link on toolbar
This button works in Firefox (and prob IE although I didn't test that) but it doesn't work in Chrome... It pops an empty address box.
I tried with both the CSH and non-CSH snippets posted above.
Any idea how the .js needs to be modified to work for Chrome ?
Ideally I'd like the button to just invisibly copy the link to the users clipboard but I'm not sure if that's possible.
I tried with both the CSH and non-CSH snippets posted above.
Any idea how the .js needs to be modified to work for Chrome ?
Ideally I'd like the button to just invisibly copy the link to the users clipboard but I'm not sure if that's possible.
Re: Create "Open topic with navigation" link on toolbar
Hi
The code I'm using is:
Then under Skins > [My Skin] > Styles > ToolbarItem > CurrentTopicLink, I have the OnClick property set to GetCurrentTopicLink()
Works fine for me under Chrome (use it several times a day!) and Firefox, IE.
Is that different to the code you have?
Richard
The code I'm using is:
Code: Select all
function GetCurrentTopicLink() {
var link = parent.frames["body"].location.href; prompt("Address:", link.replace("Content/","default_CSH.htm#"));
}Works fine for me under Chrome (use it several times a day!) and Firefox, IE.
Is that different to the code you have?
Richard
---
Using Flare 7.0
Using Flare 7.0
Re: Create "Open topic with navigation" link on toolbar
Hi All,
Waking up an old thread, as the ability to work out the correct path is incredibly useful for us (so, thanks Dave). However, have a slight problem.
We have multiple projects, that are all then pulled together by a 'meta project' (so TOC on Project A points to targets on project b,c,d).
Because the projects can't all be called Default, they each need their own name - but that means that the hardcoded 'default_CSH.htm' in the script is incorrect. So the path doesn't work for linked projects.
I don't mind naming the output files after the projects, or anything else - but is there a way of inserting <variable>_CSH.htm into this script?
Disclaimer - as you can tell, I can't code Java. However, given a brief pointer, I can probably find someone who can - as long as someone can either say 'don't bother, its impossible' or 'yes, and this is the variable you could use'. Asking a java programmer friend to dive in without knowing anything to do with Flare might be unsporting.
Many thanks all.
Waking up an old thread, as the ability to work out the correct path is incredibly useful for us (so, thanks Dave). However, have a slight problem.
We have multiple projects, that are all then pulled together by a 'meta project' (so TOC on Project A points to targets on project b,c,d).
Because the projects can't all be called Default, they each need their own name - but that means that the hardcoded 'default_CSH.htm' in the script is incorrect. So the path doesn't work for linked projects.
I don't mind naming the output files after the projects, or anything else - but is there a way of inserting <variable>_CSH.htm into this script?
Disclaimer - as you can tell, I can't code Java. However, given a brief pointer, I can probably find someone who can - as long as someone can either say 'don't bother, its impossible' or 'yes, and this is the variable you could use'. Asking a java programmer friend to dive in without knowing anything to do with Flare might be unsporting.
Many thanks all.
Re: Create "Open topic with navigation" link on toolbar
Replying to my own query. One of our javascript guys came to the rescue :
Using the below code, the system takes whatever was the name of the Webhelp (so not only 'Default') and supplies that in the URL. This means that you can use the button to identify where you are in the webhelp, and generate a URL that others can use to take you directly to this page, within the frame, even if this content has been generated as a result of runtime merging of another project. Note - this launches you into the webhelp build of this merged project, not the master project - but it is sufficient for my needs, at least...
function GetCurrentTopicLink()
{
var link = parent.frames["body"].location.href;
var endposition = link.lastIndexOf("Content/");
var begposition=link.lastIndexOf("/",endposition-2);
prompt("Address:",link.replace("Content/",link.substr(begposition+1,(endposition-begposition)-2)+"_CSH.htm#"));
}
Hope it helps
Using the below code, the system takes whatever was the name of the Webhelp (so not only 'Default') and supplies that in the URL. This means that you can use the button to identify where you are in the webhelp, and generate a URL that others can use to take you directly to this page, within the frame, even if this content has been generated as a result of runtime merging of another project. Note - this launches you into the webhelp build of this merged project, not the master project - but it is sufficient for my needs, at least...
function GetCurrentTopicLink()
{
var link = parent.frames["body"].location.href;
var endposition = link.lastIndexOf("Content/");
var begposition=link.lastIndexOf("/",endposition-2);
prompt("Address:",link.replace("Content/",link.substr(begposition+1,(endposition-begposition)-2)+"_CSH.htm#"));
}
Hope it helps