It looks good that there is a direction to go or at least try.
It stays completely on localStorage, giving you the ability to share knowledge through your tabs within the same domain.
The code below does not work yet (this is only the direction), so do not expect too much from its launch, as it is.
What it does: it saves pop-ups at the URL in localStorage, and when you try to open a new one with the same URL, it will not. If you do not want to distinguish them by URL, it is even simpler: save boolean in localStorage instead of an object.
What he does not do, but must:
onunload () reset localStorage . localStorage boolean falseonunload (, ) , reset - . , , ( localStorage, , , , ) localStorage boolean false.
, , , . , , :
function getOpenPopups() {
var obj = localStorage.getItem('mypopups');
return obj ? JSON.parse(obj) : {};
}
function setOpenPopups(object) {
localStorage.setItem('mypopups', JSON.stringify(object))
}
function popup(url, title) {
var popups = getOpenPopups();
if (!popups[url]) {
popups[url] = true;
setOpenPopups(popups);
return window.open('abc', 'cde');
}
else {
return false;
}
}
jsFiddle