First, some background... I have a mapping application in which a child window can open where there are links. When a link is clicked the child window needs to say "Hey map! such-and-such link was clicked now zoom to this location and mark it."
I'm trying to think of a good clean way to accomplish this. Are there any patterns out there people use to communicate between browser windows in this fashion? Maybe some type of Observer pattern for web pages?
Right now there is some code in place accomplishing this, but it's a pretty confusing situation and always takes me a long time to figure out what exactly is going on when I have to dig into it.
Essentially when a link is clicked in the child page a function via window.opener (the map page) is called that stores some data in a hidden field and programmatically clicks a callback button that populates the callback results with what's in the hidden field then the button event handler does it's business with the callback results.
I feel like it's a problem that probably needs to be solved often, but I can't seem to find much information. Is this the only way?
Update
In response to the comments... Thinking of a solution has proven difficult for me; at least thinking of one different than what is currently in place. However, my idea was something like the observer pattern. Where the second page could be observed for links being clicked by the default page. My issue was doing such a thing in a web environment. I did find the following link though, perhaps it will help...
http://www.codeproject.com/KB/aspnet/observer-pattern-asp-net.aspx