title: Targeting same browser tab from an external program
body: <p>We are opening a webpage when a user clicks a button from an external program (non-web). The problem is, when the user goes back to the program and opens another one, it opens in the same browser window but a different tab. After a few hours of this, our non-tech savvy clients have 30+ tabs open which really slows down their computer.</p>
  
  <p>The language we are using in the external program is RPG (IBM iSeries). We haven't found a way to target the same tab from RPG. The user is sitting at a specialized telnet session called 5250 where the server program (RPG) can call exe's on the connected PC. It can also call URL's and that will use the client's default web browser. When doing this the only real parameter you can specify is the URL itself, so we're thinking the solution needs to be entirely in the browser. We could write an exe to call the browser, but that would defeat the purpose of migrating these to web apps.</p>
  
  <p>Is there a way to achieve this with HTML/JavaScript/PHP/etc? We have tried having the external program call a redirect script (JavaScript) that will target a browser tab and then close itself. This would be a great solution if browsers weren't so picky with security.</p>
  
  <p>Firefox: has a special setting you have to set so JavaScript can close the tab
  IE: won't open the popup until the user picks 'allow popups from this domain'. but the original tab closes itself before the user gets to do this.
  Chrome: Chrome kills the reference to the named tab. So, each new popup opens in a new tab anyway (even though they are calling the same target name).</p>
  
  <p>We have been getting really creative with this but haven't come up with a solid solution. This is an intranet project, but we'd like to avoid having to install or set things on each computer due to the sheer number of PCs at these companies.</p>
  
  <p>In a nutshell, the main issue is the second RPG opens a new window, that new window doesn't have any reference to previously opened named tabs.</p>