/    Sign up×
Community /Pin to ProfileBookmark

Return from Pop-up Window

I am using a pop-up window as a sub-menu, but when I click on a link in that window, the new page opens within the pop-up menu. I can by-pass this by specifying target=”_new” in the links, but that opens up a new browser window. What I want to do is have the link appear in the original window underneath the pop-up, from which the pop-up was invoked. I know there is a Javascript property called “opener”, meaning the original window, but I can’t make any script work to achieve this. Any ideas, anybody?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@JonaOct 04.2003 — [font=monospace]

opener.location.href="page.html";

// or

parent.location.href="page.html";

[/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@GrobiusauthorOct 07.2003 — That doesn't work -- in fact nothing happens at all!

Here is the script I used:

<script language=javascript>

function goBack(newpage) {

opener.location.href=newpage;

}

</script>

And here is the link:

<a href='#' onClick="goBack('http://www.page.htm');">Page to Show</a>

Is the problem that MSIE does not recognize 'onClick' for a link, only for an Image?
Copy linkTweet thisAlerts:
@CharlesOct 07.2003 — [font=georgia]The trick is in keeping the site working for those who do not use JavaScript and for those who close the parent window.[/font]

[font=monospace]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

"http://www.w3.org/TR/html4/strict.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta name="Content-Script-Type" content="text/javascript">

<title>Example</title>

<p><a href="test2.html" onclick="window.open(this.href, 'child', 'height=400,width=200'); return false">test</a></p>[/font]

[i]And[/i]

[font=monospace]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

"http://www.w3.org/TR/html4/strict.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta name="Content-Script-Type" content="text/javascript">

<title>Example</title>

<p><a href="http://www.w3.org/" onclick="if (window.opener) {opener.location = this.href} else {window.open(this.href)}; return false">test</a></p>[/font]
×

Success!

Help @Grobius 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.19,
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,
)...