Skip to main content
Participant
June 7, 2006
Question

Set window focus for tripane window?

  • June 7, 2006
  • 3 replies
  • 464 views
Currently, our WebHelp for my company's ecommerce application targets a specific topic in a named window. Each topic uses the following onLoad command in the body tag to force the named window to the top.

onLoad="top.window.focus()"

Using the named window prevents users from opening endless help windows. Using the onLoad command is thus required, otherwise the help content would remain hidden behind the web application window and users would think their help link was defective.

But the help links only open the standalone topic; users then have to click the "Show" text link if they want to use the full tripane navigation features (search, index, TOC, glossary, toolbar, etc). Recent user feedback expressed a preference for displaying the full WebHelp navigation directly from the help link.

The problem is I can't see a way to deliver the same "bring to top" function of the single-topic into use for the frameset. In fact, if we use a named window to invoke the topic within the frameset (e.g. ~/helpdirectory/index#topicname.htm), the help window not only won't return to the top, the window does not refresh with the new topic.

Any known solutions out there?
This topic has been closed for replies.

3 replies

Inspiring
June 9, 2006
Here's another approach (omitting the open bracket < ):


A HREF="----path----/help.htm#topicname.htm" onclick="newWin = window.open(path----/help.htm#topicname.htm ,'help');newWin.close();" target="help"><IMG src="images/help.gif"></A>

The HREF string is generated somewhere else. There's a table that supplies the topicname appropriate for the specific page of the application.

Alas, this, too, destroys the help browser history. On the other hand, the TOC is right there. Also, for what it's worth, the RH browse sequences still work fine.

Harvey

Inspiring
June 9, 2006
Hi, BaldAndy,

You might adapt this snippet to close and relaunch the tripane version.
There is a downside, however: Browser history gets broken. Some of our colleagues can't abide that. And you may not be happy with the response time.


if (newWin.location.href != strUrl) {
// If the window already existed, then close and reopen
// For some reason, existing window will not switch to specified URL
newWin.close();
newWin = window.open(strUrl, "newWin", strOptions);
}
newWin.focus();


Harvey
Peter Grainge
Community Expert
Community Expert
June 7, 2006
I don't know if this will be of any help to you. Click here.

Use the menu (bottom right) to mark the Best Answer or Highlight particularly useful replies. Found the answer elsewhere? Share it here.
BaldAndyAuthor
Participant
June 8, 2006
The script detailed by tsimmons doesn't exactly work.

It works in the sample page, but the links all originate from the same page. To emulate a web application, I produced two pages, each with the page specific help link copied directly from the tsimmons sample.

First help click works great. It appears for the specific page, in the defined window.

If you move to a second web app page and click its help link, with the corresponding topic specified in the link, the help window appears correctly, but does not insert the new, second topic. You have to reclick a second time to get the insertPage function to place the corresponding help for the second page.

Does the ordering of the functions in the script cause this problem?

The sample pages are at here.

I did remove the javascript from the test web pages and referenced a single .js file. Could this be an issue?

Here is the js code, only slightly modified from the tsimmons sample to remove the search and read title functions.

var thisTitle = this.document.title;
var winExists = "";
var searchExists = "";
var newWin
var newSearch

function makeUrl(strUrl) {
if (newWin && !newWin.closed) {
strUrl = "WebHelp/" + strUrl;
showPage(strUrl);
}
else {
winExists="";
strUrl = "WebHelp/cshlp.htm#" + strUrl;
showPage(strUrl);
}
}


function showPage(strUrl) {
if (winExists=="") {
openWindow(strUrl);
}
else {
insertPage(strUrl);
}
}

function openWindow(strUrl) {

var w_left = (screen.width/8);
var w_top = (screen.height/8);
var w_width = (screen.width/2);
var w_height = (screen.height/2);
var strOptions = "location=no";
strOptions += ",toolbar=yes";
strOptions += ",menubar=no";
strOptions += ",status=no";
strOptions += ",scrollbars=yes";
strOptions += ",resizable=yes";
strOptions += ",left=" + w_left;
strOptions += ",top=" + w_top;
strOptions += ",width=" + w_width;
strOptions += ",height=" + w_height;
strOptions += ";";
newWin = window.open(strUrl, "newWin", strOptions);
winExists = 1;
newWin.document.close();
newWin.focus();
}

function insertPage(strUrl) {
newWin.frames[1].frames[1].location.href = strUrl;
newWin.document.close();
newWin.focus();
}



-->