0
votes

A url ParentUrl is opened in a window MainWindow On click of a button in that page I am opening a new window - Window-1

window.open(url1,"","width=1024,height=600,scrollbars=yes")

Now in this opened window (Window-1) I have another button which on click opens a new url in a new tab

window.open(url2)

Now this url2 is getting opened in a new tab in the parent window( Main Window ) . So Window-1 is getting minimized. I want the new tab to be opened in the window from where I triggered the click

2

2 Answers

1
votes

You can't.

First of all: Javascript is not aware of tabs. The window.open API was written long before tabs existed, and was never updated to handle them. As far as it is concerned, tabs are just a weird kind of window.

Second: In all major browsers, popup windows created by window.open (with the third argument set) are treated as being different from the main browser window. They can't be moved back into the main window, and can't have tabs opened in them.

-1
votes

You can use the function according to this definition :

window.open(URL, name, specs, replace)

You have to use _parent in the in place of name, you can find more details : Here > W3 Schools