0

I have to implement the next requirement: From a specified page I have to open a new page (new browser tab, lets call it Live tab) and focus on it. Only one Live tab can be opened at a time

What I've tried is

const win = this.window.open(url, 'New tab');
win?.focus();

This is working as expected but if the Live tab is already opened, the focus operation triggers a refresh of the Live tab every time.

Can we prevent this somehow ?

Mihai Alexandru-Ionut
  • 47,092
  • 13
  • 101
  • 128
  • This answer explains it: https://stackoverflow.com/questions/25963141/window-focus-without-refresh-in-javascript – Blunt Jackson Dec 05 '22 at 16:58
  • 1
    It's not the focus operation that causes it to refresh, it's caused by opening the url in the already opened window – Lennholm Dec 05 '22 at 17:03
  • 1
    You can keep a reference to the pop up, but once the page that opens up the pop up is destroyed, you will not be able to reference that pop up. Basically you will not be able to handle every edge case. – epascarello Dec 05 '22 at 17:12

0 Answers0