'Making an inactive browser tab active again automatically using react js
Im building a react app. in the app, Im receiving a message through an API and if I receive a message, the message automatically display to the user.
But the problem is if the user is on another tab, they cannot see whether a message is received. I want to make the react app tab active immediately if the user is browsing on another tab after receiving a message. Is there a way in react to make the tab automatically active?
Solution 1:[1]
There is not.
The only solution I can think of is to create a push notification that could display the message to the user even if he is on another tab.
Intro to push notifications here: https://www.studytonight.com/post/javascript-desktopbrowser-push-notification-example
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tomáš Tušer |
