Controlling browser window through Javascript

i have a web app that launches an URL in other windows/tabs. I would like to check if the window/tab exists; if not, i want to create it else i would like to pick it in first position. I use:, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450');

But it goes well only the first time (in IE, not in Firefox); if i create a new tab in the window, when i call nothing happens; if i close the window it the recreates it but keeps it iconized ... Is there a way i can follow to obtain a good result?

Thanks in advance Greetings, c.

Here's some code I've used for ages that still works as far as I know. Notice that oWindow has global scope, and that I pass it to the second parameter of open as a string, not as the object itself. Then, I test to see if it's closed before trying to open again...if it's already opened, then I just give it focus:

var oWindow;

function openWindow(p_strURL) {

    if(!oWindow || oWindow.closed) {
        oWindow =, "oWindow", "status, scrollbars, resizable, width=800, height=500");
        if(!oWindow.opener) {
            oWindow.opener    = window;
    else {
        oWindow.location.href = p_strURL;

Hope it helps you find a solution,


web_form_target is the window name.

if ( !==  web_form_target) {
   // create it