My main goal is:
Going to my application, open a link there in a new tab, make something in the new tab and send an event to the parent-main tab to refresh.
By seeing how similar questions only talk about window.open
(which you don't want to use) and as afaik there is no easy way to get all windows on the same domain, for what you want, you probably need to write your own framework to do this using window.sessionStorage.
I don't think you'll get access to subdomains with it and definitely not to other domains, though.
Practical ideas for window-specific message passing using sessionStorage
..
You can pass things in the URL (GET) so a way to pass messages could be to make the parent generate a unique id for itself parentID
, a unique id for it's child childID
(which is inserted into the URL along with the parentID
on click if you're using an , or a hidden field if you don't mind a
), then with
sessionStorage
save messages to the parent using keys like parentID.childID.timeStamp
, have an interval in both parent and child that looks for sessionStorage
keys starting with the window's ID, then a .
, (i.e. the parent looks for parentID.
) on a match copy the key & value to a new var, delete (so it doesn't get found again) and then parse as desired.
I know this is a bit wordy but I think it is likely much easier to explain as a concept than writing working example code.