/    Sign up×
Community /Pin to ProfileBookmark

Retrieving window object by name

Hi,

I am looking for a way to get a window object according to a name that was previously assigned to this window object.

[COLOR=”Red”]var thaWindow = window.open(”,’main_window’);[/COLOR] is kind of working… but i don`t want the focus.

Example:
A page opens a pop-up window. The pop-up window need to communicate with the page that opened it. I know all about the [COLOR=”Red”]opener[/COLOR] object, but it doesn’t do the job since my main page (the one that open the pop-up) could be refreshed by the user, thus breaking the [COLOR=”Red”]opener[/COLOR] reference in the pop-up ([COLOR=”Red”]opener [/COLOR]objet is undefined). The name assigned to a window object seems to still live after a refresh.

Any clue?

Thanks

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@toicontienJun 06.2007 — You could try giving your window object a name while the page is loading. Just put this snippet somewhere in the HEAD of the HTML document, before the new window opens up:
<script type="text/javascript">
<!--
window.name = 'foo';
// -->
</script>

Then see if the opener object remains in the opened window. Then again, if the user hits refresh, or navigates to a new window, what's the point in updating a window object that the user no longer has access to?

Also, you might be trying to take advantage of a browser memory leak. The behavior you are describing doesn't sound like it should happen.

EDIT: It might also stay in memory after a refresh because the window names are the same, but the opener object would be a reference to the refreshed window object. Any changes made during the course of use might be wiped out when you refresh the opening page.
Copy linkTweet thisAlerts:
@F4T4L_1lln3ssauthorJun 06.2007 — Thank you for your answer toicontien.
×

Success!

Help @F4T4L_1lln3ss 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.15,
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,
)...