/    Sign up×
Community /Pin to ProfileBookmark

Controling popups and parent windows

Greetings ya’all

I have created a website where the visitor can click on a link, whereupon he gets a popup in which he can choose between two PDF documents to be displayed, Currently when he clicks on either link, the popup closes and displays the chosen document in the parent window. Which is actually fine, but I want the popup to close and open the chosen document in a new (fullscreen) window. The parent window from which the popup was opened should also stay open.
Below the script I am currently using …

<a href=”javascript:self.close();” onclick=”goAndClose(‘../mydoc.pdf’)”>Document1</a>

<script>
<!–
function goAndClose(page)
{
opener.location.href = page
this.close;
}

//–>
</script>

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@CharlesSep 09.2003 — [font=monospace]<a href="../mydoc.pdf" onclick="window.open(this.href, 'child'); return false">Document1</a>[/font]
Copy linkTweet thisAlerts:
@manualauthorSep 09.2003 — Thanx Charles

One thing though the popup window does not close. When I click on Document1, the new window opens as required, but the popup stays open.
Copy linkTweet thisAlerts:
@CharlesSep 09.2003 — [font=monospace]<a href="../mydoc.pdf" onclick="window.open(this.href, 'child'); if (self.opener && !self.opener.closed) self.opener.close(); return false">Document1</a>[/font]
Copy linkTweet thisAlerts:
@manualauthorSep 10.2003 — Hi Charles

I realy appreciate the help. JavaScript stays one of my constant headaches, I cannot seem to wrap my mind around it.

Ok, with your script above the following happens. When I click on Document1 I get a message "This programm is trying to close this window" If I say "yes" the parent window closes, the popup stays open, and the document1 opens in a new window.

I want to keep the parent window open, close the popup and open the Document1 in a new full window.

Thanks again for the help, it is appreciated.
Copy linkTweet thisAlerts:
@CharlesSep 10.2003 — [font=georgia]I need you to more fully explain what you are trying to accomplish. At first I thought you had two window and now it looks loke you have three.[/font]
Copy linkTweet thisAlerts:
@manualauthorSep 10.2003 — Hi Charles

Thanx again for the help ...

Yes there are 3 windows

1-fullscreen

2-popup

3-fullscreen

On window 1 I have a link "Documents", when the user clicks on it it opens window 2 (the popup) here the visitor can choose Document1 or Document2. If he clicks on either of them, the popup should close and open the selected document (pdf format) in a new window 3. Window 1 should stay open throughout all of this.

I would have included direct links to the documents, unfortunately I have a bit of a space problem on the page and the client requested it this way. The client is king, right?

Thanx again ...
×

Success!

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