简体   繁体   中英

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");

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM