/    Sign up×
Community /Pin to ProfileBookmark

Popup links to Parent Window – backup?

One of my clients has requested the following…
– Click a link to open a popup window
– Click links in the popup window to change content in parent window

I have this working well at the following test URL – [url]http://pixgroup.com/popup/[/url] (click the links and you’ll see that they load in the parent window).

The problem is that if someone closes the parent window, the links in the popup window no longer work. Is there a way I can code this so the links open in the parent window… but open in a new window if the visitor has closed the parent window?

Here is the key code snippet…

[code]<a href=”javascript:void(0);” onClick=”window.opener.location.href=’http://www.yahoo.com’;”>YAHOO[/code]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@maurycyApr 25.2013 — [CODE]<html><head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>Untitled Page</title>
<script type="text/javascript">
function openWindow(link) {
if(window.opener !== null) {
alert('open in opener');
window.opener.location.href=link;
return false;
} else {
return true;
}
}
</script>
</head>

<body bgcolor="#ffffff">
<p><a href="http://yahoo.com" onclick="return openWindow('http://yahoo.com');" target="_blank">YAHOO</a></p>
<p><a href="http://www.google.com" onclick="return openWindow('http://www.google.com')" target="_blank">GOOGLE</a></p>
<p><a href="http://www.apple.com" onclick="return openWindow('http://www.apple.com')" target="_blank">APPLE</a></p></p>
</body></html>[/CODE]
Copy linkTweet thisAlerts:
@idesign123authorApr 25.2013 — Your code worked perfectly - thank you SOOO much for your help! ?
×

Success!

Help @idesign123 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.8,
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,
)...