How to set focus to already opened tab in firefox?

后端 未结 5 1013
不思量自难忘°
不思量自难忘° 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:35

    You can probably use _blank and some JS code that closes a previously opened tab for the same URL using cookie tracking.

    The page (that you are opening in the new tab) should be built in such a way that it writes out a cookie with some value (say current time in millis). It should also have some kind of a periodic poller that checks the value of this cookie and closes itself when the value is seen to be changed. the only way this value can change is when the same url is opened in another tab/popup.

    Disclaimer: Not sure if browsers will allow window.close without it being user triggered though!

提交回复
热议问题