Answer the question
In order to leave comments, you need to log in
Is there a js library to run js in only one tab?
Situation: there is a js code that listens to events on websockets when a page is opened. When opening an additional tab with the same page, one more websocket connection will be opened, and this is superfluous, because. when an event arrives via websocket, notifications are shown, i.e. there will be overlap.
Is there a js library that keeps track that there is an open page in a tab? And executes the code if there is no other tab or that tab is closed?
Answer the question
In order to leave comments, you need to log in
https://github.com/ai/visibilityjs
https://github.com/studentIvan/dueljs
You need a Master / Slave, you can implement it using:
- SharedWorker + fallback in localStorage and / or LocalConnection (Flash) - if you do it yourself
- BNC Connector - theprivateland.com/bncconnector/home.htm
- Intercom.js - https:// github.com/diy/intercom.js/ (working with sockets out of the box)
- Wormhole.js - https://github.com/RubaXa/wormhole (in development, demo )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question