How to set focus to already opened tab in firefox?

后端 未结 5 1006
不思量自难忘°
不思量自难忘° 2021-02-19 05:59

I have a link which opens a page in a new tab in firefox.


    Go to Portal

Howe

5条回答
  •  感动是毒
    2021-02-19 06:40

    For getting the focus using a tabhandler name may help.. suppose we have

    win = window.open("https://www.google.com", "test");
    
    win.focus();
    

    now every time the first line of above code runs the browser will first find the tab with the name test and reload it with the url https://www.google.com and in case it does not find a tab with the name test it will open a new one. On the run of the second line it will set the focus to the same tab loaded from the first line.

提交回复
热议问题