/    Sign up×
Community /Pin to ProfileBookmark

I it possible to assign a window’s opener object?

Hi all,

I have a window with a form that is accessed directly. I would like to pop open another window from it and make the new window the parent/opener. I’ve tried the following but I keep getting ‘opener is null’ after trying to access the new parent’s Javascript methods.

[CODE]childWindow = window.open(someUrl);
window.opener = childWindow;

opener.someMethodInNewParent();[/CODE]

Am I going about it the correct way? Or is it not even possible to create a window and assign it as an opener to an existing window?

Thank you in advance.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@KorJan 04.2011 — You are confusing me. If you have a page A and you open a page B, as a pop-up from page A, the opener is the page A, not B, and only if seeing from inside the page B.

You can not "make a page as opener" by a simple assignment. A page [I]is or is not[/I] an opener if you open another page from it (using the [B]window.open()[/B] method), or not. To be an opener is a [I]state[/I] of being.

Can you re-form your aim, please? What, in fact, you want?
Copy linkTweet thisAlerts:
@jmendez2authorJan 05.2011 — My aim was to open a window and access its existing code.

Apologies for not wording my question correctly. I found the solution. My problem was not not being able to assign page B as the opener to page A. My problem was waiting for page B to load its content, it took a while to load. After I was able to figure out how to wait for page B to load, i was able to access page B's variables and methods. I just did not want to modify page B's code.

Thank you for the reply.
×

Success!

Help @jmendez2 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...