Focus tab or window

前端 未结 11 714
慢半拍i
慢半拍i 2020-12-06 16:19

for a little app, I\'m opening a few windows/tabs from my script. Whether the browser opens a window or a tab is of course not in my hand.

However, I hold the refere

11条回答
  •  既然无缘
    2020-12-06 17:00

    The only solution I see, is to force the popup in a new window, since there doesn't seem to be a way to focus another tab. This solution also requires you to change the default Javascript security settings in Tools > Options > Content tab and click on the Advanced button next to Enable Javascript checkbox and check the middle box to allow focusing windows.

    To force the use of a window rather than a tab, use win = window.open("http://www.google.com", "test" ,"modal=yes"); and then call win.focus(); whenever you feel like it.

    EDIT: Actually forgot to mention the fact that this is FF only.

提交回复
热议问题