0
votes

I have created dc.js visualization have four different bar graphs. Also each graph have a button to open that particular graph in new browser window. For that purpose I have created separate HTML file for each graph. I want to interact between the graphs opened in two different windows. Is it possible? How?

Thanks!

1

1 Answers

0
votes

window.opener will return a reference to the window object of the window that opened it.

In the first window, you can leave a global reference (let's say var graphThing or window.graphThing) to whatever object you need to manipulate. Then, the window that's launched from the original window can call window.opener.graphThing to access the first window's graphThing.

To access a property of the child window (let's say global var childGraphThing or window.childGraphThing) from the parent that opened it, you can keep a reference to the child window by opening it like this:

var childWindow = window.open('childGraph.html', 'blank_');

Then, you can access it's properties like this:

var childWindowGraphThing = childWindow.childGraphThing;