views:

53

answers:

1

i have used a js code to open a hyper link in a new window.

function openNewWindow() {
    alert("hello");
    var theurl="http://www.google.com";
    popupWin = window.open(theurl, 'open_window',
                           'menubar, toolbar, location,
                           directories, status, scrollbars,
                           resizable, dependent, width=640,
                           height=480, left=0, top=0')

}

And it's working fine.

But when i have changed the url and saved my code and refreshed the page, then called the function again, but it's not opening in a new window, it has refreshed the window opened before.

I want my new link to open in another new window, not in the same.

How can i do this?

If any one has an idea please share it.

Thanks

+3  A: 

The name you give to the opened window, open_window in your example, is associated with that windows, so that you can re-use it.

If you want a new window to open, give it a new name, or _blank to always open a new window.

I struggled finding a source to verify this, but it's explained on this page.

SpoonMeiser