I have Stock Charting website where users logs in and session is stored in php.
When Users is logged , I want to restrict them to have only 3 tabs (or N tabs) at a time.When 4th tab is opened , 1st tab should have some kinda warning or I do some javascript stuffs to disable ajax going on.
I am able to store each url using following code
var location = location.href;
var old = window.sessionStorage.getItem("activetabs");
old = JSON.parse(old);
newone = old.push(location);
newonestring = JSON.stringify(newone);
window.sessionStorage.setItem("activetabs", location);
I tried to setTimeout and check every 10 seconds if the url is not in last 3 elements.But duplicate url will not work here.
PS : I am trying to block the old url's if its all same URL or different URL's ,but all url are same domain.