Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 330
  • Last Modified:

re-use same child window in multiple hyperlinks

I'm writing a HELP system. I want hyperlinks on my website to open individual help pages. But, I do NOT want to "Open New Window" and "Open New Window" and "Open New Window" ... arrrrgh I personally dislike all those stupid windows!

How do I tell a dozen different hyperlinks to REUSE the exact same "child" window which may (or may not) have already been opened by an earlier hyperlink?

so I get one "new" window used over-and-over again.
0
volking
Asked:
volking
  • 5
  • 2
  • 2
5 Solutions
 
frinCommented:
use <a href="help.html" target="helpWindow">Help</a>
0
 
frinCommented:
Or if you prefer JavaScript, this does the same (second parameter to open function):

<a href="#" onclick="window.open('help.html', 'helpWindow', 'true');">Help</a>
0
 
James RodgersWeb Applications DeveloperCommented:
both above will work, however once teh window is open and the user returns to teh parent, when a new link is clicked the child window will remain in the background
try adding this to the second option

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
      <title>Untitled</title>
<script language="JavaScript" type="text/javascript">
var newWin='';
function setWindow(url){
      if(!newWin || newWin.closed){
            newWin=window.open(url,'','true');      
      }
      newWin.focus();

}


</script>
</head>

<body>
<a href="#" onclick="setWindow('somePage.html');">Help</a>



</body>
</html>
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
James RodgersWeb Applications DeveloperCommented:
sorry, forgot a line in teh function

<script language="JavaScript" type="text/javascript">
var newWin='';
function setWindow(url){
      if(!newWin || newWin.closed){
            newWin=window.open(url,'','true');      
      }else{
            newWin.location=url;
      }
      
      newWin.focus();

}


</script>
0
 
volkingAuthor Commented:
So these lines would open different help pages but all into the exact SAME browser window? Right?

<a href="login.htm" target="helpWindow">AboutLogin</a>
<a href="signup.aspx" target="helpWindow">SignupHelp</a>
<a href="contact.html" target="helpWindow">TalkBack?</a>

So the key is ..... target="WhatEverName"
0
 
volkingAuthor Commented:
The javascript option is good too, but can bookmarks be passed in the urls?

<a href="#" onclick="setWindow('SignupHelp.htm#bookmarkAAA');">Help</a>
<a href="#" onclick="setWindow('SignupHelp.htm#bookmarkBBB');">Help</a>
<a href="#" onclick="setWindow('SignupHelp.htm#bookmarkCCC');">Help</a>
0
 
James RodgersWeb Applications DeveloperCommented:
yes, but once a user returns to teh parent window the other window will remain in the background and will not gain focus if teh user clicks on another link

also note there are a  couple of keyword  target=
see here http://www.htmlcodetutorial.com/linking/_A_TARGET.html
0
 
James RodgersWeb Applications DeveloperCommented:
>>The javascript option is good too, but can bookmarks be passed in the urls?
any valid url format can be passed
somePage.html
somePage.html?var=value&anotherVar=value
somePage.html#anchorName

can all be passed to the js function
0
 
James RodgersWeb Applications DeveloperCommented:
glad i could help

thanks for the points
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 5
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now