Michael
Michael

Reputation: 13614

How to pass data from parent window to child popup window

I'm newer in web programming so maybe my question will seem naive to some of you, I need to pass data from parent window to child popup window.

I found in google only opposite examples(i.e passing data from child to parent).

I will appreciate if you could share with example, or short explanation.

Thank you in advance.

Upvotes: 0

Views: 4374

Answers (1)

jamesism
jamesism

Reputation: 216

As long as the popup you open abides by the Same-Origin policy you have full access to the document. And then you can just do something like this:

var child = window.open('about:blank'),
    something = document.createElement('div');

something.innerHTML = "<h2>Something!</h2>";

child.document.body.appendChild(something);

Upvotes: 1

Related Questions