How to normalize ajax call for multiple tabs?
I have created an application where on every page in the header, notifications, messages are loaded using an ajax call.
I repeated the action half a minute apart.
So, every half a minute, a new request to the server starts.
I found that if the user opens the app in multiple tabs, each tab triggers a request to the server to check for a new notification / message.
So, each new tab creates 1 additional request.
How do I normalize the condition?
What I mean is --- I just want to run a single request to the server to check notifications / messages so that the entire thinking user has multiple tabs open and also refreshes the data on every open application tab.
source to share
Perhaps for each parameter, you can store its value and timestamp in a cookie and check it before submitting your request. You can also use local storage. http://www.html5rocks.com/en/features/storage
source to share