/    Sign up×
Community /Pin to ProfileBookmark

Naming Windows

Hi –
I am presently developing a site. I would like to name a window so when a do a ‘target=’ command for a ‘href’ I can send the browser to back to that window.

example
first window – links that open to target=_blank (second window)
second window – running an app that automatically opens a small window (target=_
top) – thus, the third window
third window – I would like to refer back to the first window
If I do a target=_parent, it goes back to the second window because technically that is the parent to the third window.

any help is always appreciated….

basically – can you name the first window (say window1) that
you can do a target=_window1

???

thanks -jr

to post a comment
HTML

5 Comments(s)

Copy linkTweet thisAlerts:
@coppocksDec 03.2006 — If I understand you correctly...

Parent opens -> Child -> opens grandchild. You want Grandchild to talk to Parent (grandparent), yes?

parent.html<i>
</i>&lt;html&gt;
&lt;head&gt;
&lt;script&gt;
function newWin(loc) {
var location = loc;
//window.open(location, 'foo', 'width=400,height=250,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
remote = window.open(location, 'remotewin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=No');
if (remote.opener == null) {
remote.opener = window;
remote.opener.name = "opener";
}
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;a href="JavaScript:newWin('child.html');"&gt;Open Child&lt;/a&gt;
&lt;form name="ParentForm"&gt;
&lt;input type="text" name="Test"&gt;
&lt;/form&gt;


... opens child.html<i>
</i>&lt;html&gt;
&lt;head&gt;
&lt;script&gt;
function newWin(loc) {
var location = loc;
//window.open(location, 'foo', 'width=400,height=250,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
remote = window.open(location, 'remotewin2', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=No');
if (remote.opener == null) {
remote.opener = window;
remote.opener.name = "opener";
}
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;a href="JavaScript:newWin('grandchild.html');"&gt;Open GrandChild&lt;/a&gt;

... opens grandchild.html...
<i>
</i>&lt;html&gt;
&lt;head&gt;
&lt;script&gt;
function talkParent() {
window.opener.opener.document.ParentForm.Test.value = 'Grandchild!';
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;a href="JavaScript:talkParent()"&gt;Talk to GrandParent&lt;/a&gt;


Click on link in the grandchild.html and "Grandchild!" will appear in the first window/parent form text field.

That should get you on yer way.
Copy linkTweet thisAlerts:
@jerryr125authorDec 03.2006 — Hi - thanks for the information. Although, I dont think that will work since the application I have link from I cannot add javascript. Basically, do I name the window name 'grandchild' a name and when I am in the grandparent, have the target=_grandchild ???
Copy linkTweet thisAlerts:
@coppocksDec 03.2006 — What??? Then no... No JavaScript. No communication between windows. No matter what you call or name them. But if you know the names of each window, then you can link target them.

So for window3 to open a link in window1, window1 would have to have a name.

So anything you want to name the target will work.

Without using any script... You'd have to have 3 (total of 4) browsers opened.

Window #1... YOUR PRIMARY WINDOW launches parent with:

<a href="parent.html" target="parent">Open Parent</a>

Now, that window is named "parent".

From within the parent window...

<a href="child.html" target="child">Open Child</a>

Now you have a window named "child".

From within the child window...

<a href="grandchild.html" target="grandchild">Open grandchild</a> <p>

Now you have a window named grandchild.

From within that window...

<a href="http://www.yahoo.com" target="parent">Open Yahoo in Parent</a>

That will open Yahoo in the first window you opened from the third window you opened, named grandchild.

Name the target whatever you want. I just used parent-child relationship so it would be easier to understand, or so I thought.
Copy linkTweet thisAlerts:
@jerryr125authorDec 04.2006 — close - very close, thank you ?

ok - what if you intialially start with the first window opened - is there

a tag you can set to name that window ? that is you dont access the first window in your above example via a <a> tag ?

thanks - jerry
Copy linkTweet thisAlerts:
@coppocksDec 04.2006 — what if you intialially start with the first window opened - is there a tag you can set to name that window ?[/quote]
Not without JavaScript.

That is, using JavaScript, you can call any newly opened window's "opener". Which is what I similarly displayed in latter part of my first post with the talkParent() function. Though it may have to be written something like (not tested):

window.opener.opener.document.href= 'www.yahoo.com';
×

Success!

Help @jerryr125 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.11,
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,
)...