/    Sign up×
Community /Pin to ProfileBookmark

Help – auto-closing an under page.

I Have a need to create a page that when I log in, pops a new window that fills the entire screen. Upon doing so, I would like the original “underpage” to automatically shut down so that when I exit the pop-up window, both windows no longer exist.

I have seen other sites do this. If I go to [url]www.wfan.com[/url] and click listen live “AND” I have a pop-up blocker, a ‘tween page loads with a link that reads:

You have a pop-up blocker enabled.

Click here to launch the player!

This code is located at:

[url]https://www.radiomat.com/register.php?action=register&station=WFANAM[/url]

When I click on the link, “Click here to launch the player!”, the new page containing the player opens and the original page disappears.

I have tried to duplicate the code. My version exist at:

[url]http://www.develop4u.com/temp/wfan_underpage.html[/url]

Note though that when I click on the link, “Click here to launch the player!”, An alert box opens prompting me to close the window…this is not what I want and I have no clue as to why it does prompt me.

Side note: I skip over the step of going to wfan.com and clicking “listen now” in order to get to the page: [url]https://www.radiomat.com/register.php?action=register&station=WFANAM[/url] and instead cut and paste the url and then click the “click now” link, I get the same prompt box.

I must specifically go to wfan.com, click “listen now” and then “click here to launch the player” in order to execute the code. I don’t know why and I do not know how to duplicate the proper process.

Does anyone know how to make the under page automatically close upon triggering the op-up window without manually oking the process?

Any feedback and advice would be helpful.

Thank you.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@CrazyMerlinMay 15.2006 — from your popup page issue:

window.opener.self.close();

you can try it in the popup documents body tag as an onload event, or as a line of script at the end of the popup document, just before the closing body.

the latter is better, because then you can have error checking and if something in your popup doesn't load properly, you can close the page (with window.self.close()) and revert to the parent document.
Copy linkTweet thisAlerts:
@felgallMay 15.2006 — opener.close will work provided that you opened that window in the first place. If you are talking about a window that someone already had open before arriving on your site then you are not allowed to close it and the browser will either ignore your request or ask the person who owns the browser if they want to let you close it.
×

Success!

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