Push event and window.open, open only one window

98 Views Asked by At

I have a website with a serviceWorker push event, and then a postMessage which sends back data. When this data is received, I open a window using window.open, but if I have like 3 tabs opened, the window is opened 3 times.

I put a specific name in window.open, I even tried setting a cookie just before window.open, and then when the cookie value is 1, window.open should not be triggered.

However it does not work, I guess because window.open is called for each tab at the same time so the cookie does not exists, and technically the window name does not exist either.

I'm stuck, if anyone has an idea... Thanks a lot

0

There are 0 best solutions below