Currently, I can successfully navigate to any one of our applications 68 UI windows and click the Help menu item on our applications top tool bar. This Help menu item is in a jsp called pageHeader.jsp. Each of our 68 UI windows includes this pageheader.jsp by entering the following statement at the top of their jsp:
<%@ include file=pageheader.jsp%>
<td style="background-color: #fff;background-image: url(images/topbar_bg.jpg);background-repeat: repeat-x;margin: 0;padding: 0;">
As I mentioned above, this code works fine. Unfortunately, if, after I click the Help menu item and pop up the Help window, I then decide to switch to another UI screen, I can click the Help menu item again and a second pop up window will appear. In fact, even if I stay on the current UI window and click Help, another pop up window will appear. The customer has requested that only 1 pop up window appear. Once this window is open, then the customer can switch to any of the 68 UI windows and click Help, and then only the contents of the existing Help window will change (I actually got the contents to change during an experiment by coding window.location.href = newURL.) But the customer does not want multiple pop up windows to appear.
Despite my research and experiments, Im unable to implement this request. The only approach Ive tried is to save a reference to the pop up help window in a hidden field on the pageheader.jsp. I was thinking that if I could save the window reference to the hidden field, then perhaps I could store it in the users session where it would be available each time the pageheader.jsp is loaded. The code below works if I stay on the samd UI application window. But if I switch UI windows, then I lose the reference to my pop-up window. Can you tell me if its possible to save the window reference in the session (or request/response objects) from my hidden field? If yes, am I taking the correct approach? What more do I need to do to get the window reference into the session? If not, is there a different approach I can use to implement the customers request?
Here is my experimental code:
I call the following function to initialize the hidden input value during the loading of pagehelp.jsp
Here is my hidden field:
<td><input type="hidden" id="popupWin" name="popupWin"/></td>
win = document.getElementById("popupWin").value;
if(typeof(win) == undefined")
document.getElementById("popupWin").value = win;
else if (win.closed)
// Get the existing URL in the popup window and change the topic (experiment to test
// changing topics within the window
var url = win.location.href;
var topicIndex = url.indexOf("topic=");
var suburl = url.substring(0, topicIndex);
var newurl = suburl + "topic=main_search&";
win.location.href = newurl;
var test = 99;
document.getElementById("popupWin").value = test;
Thank you for your help.