Referencing a calling window via target (or some other way)

G

Guest

Hey folks! I RARELY program Javascript so I know very little about it.
The current project I am on requires heavy Perl, Linux shell scripting,
SSI, MySQL and Javascript and my brain is frying......

What I am hacking is a moveable type install for a travelogue. The
initial page of the site is the usual travelogue but clicking on a link
in the initial page will open a new window that displays a dynamically
coded graphic map of places visited. I can name that window through the
HREF "target" link attribute in the initial page (we'll call it
target="navigator"). Problem is when I click a link there in the
"navigator" window and want that travelogue entry to show up in the
initial window.

I thought I could use <BASE TARGET="travelogue"> in the <HEAD> of the
initial document and then use the HREF Target="travelogue" from the
Navigator window but no luck. Also for kicks I can't get _parent to do
it either.

Does anyone know how to solve this? Seems odd that an initial page can
spawn another window and you can send data to that window but not in
reverse. It seems so simple that I must be doing something wrong.

Many thanks in advance,
JC
 
M

Mick White

Does anyone know how to solve this? Seems odd that an initial page can
spawn another window and you can send data to that window but not in
reverse. It seems so simple that I must be doing something wrong.

The object reference for the "parent" window, from the spawned window's
point of view, is "opener" :

opener.someFunctionInParentPage();

Mick
 
J

Jc

Mick said:
The object reference for the "parent" window, from the spawned window's
point of view, is "opener" :

opener.someFunctionInParentPage();

FYI: You should check for the existence of opener before using it,
otherwise if the user closes the original page and then uses the popup
window to make a call back to the now closed "opener", errors will
occur.

if (opener && !opener.closed) {
// do stuff using opener
} //if

Another technique is to close any open popup windows in the onunload or
onbeforeunload events of the main window. This can be done by keeping
track of the window reference returned by the open call, and using the
same logic as above before calling close().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,436
Messages
2,571,696
Members
48,796
Latest member
Greg L.
Top