Reputation: 15958
I am opening a page using window.open(). Is there a way to pass a JSON object from the parent to the child page? Ofcourse writing data to a cookie from the parent and reading that same cookie from the new page might be an option. Any simpler ways?
Upvotes: 2
Views: 5955
Reputation: 13139
I see there are several ways to do this:
I would try to
winRef = window.open(...);
winRef.postMessage(...);
https://developer.mozilla.org/en/DOM/window.postMessage
I didn't try the third option, but it might be a nice alternative to 1 and 2.
Upvotes: 1
Reputation: 232
EDIT
var options = {foo:'foo'};
var myURL="http://localhost";
window.open( myURL + "/?options=" + JSON.stringify(options) );
didn't test that code before, try this, you can access it through GET
Upvotes: 1