Deepanshu Goyal
Deepanshu Goyal

Reputation: 2833

Stay on Current Tab while using window.open()

I am opening a window in another tab in my code, but the problem is the focus shifts to new tab opened, I want the focus to remain on the current window

I have searched for it, but have not got any solution, the focus() function is as I have understood is useful when opening popups.

I am using : window.open() function

window.open("myurl");

Upvotes: 1

Views: 2623

Answers (1)

M.I.T.
M.I.T.

Reputation: 1042

http://www.pageresource.com/jscript/jwinopen.htm also check this

You can't directly control this, because it can be configured by the user. You might try "_newtab" which might work for Firefox but really you shouldn't rely on a new tab being opened. The user may have their browser settings set to open a new tab when a popup window is opened or it may show up as a popup. It just all depends on the browser settings.

Upvotes: 1

Related Questions