/    Sign up×
Community /Pin to ProfileBookmark

opening/closing a window

Hi all.

Here is what i want to do:

When i click on the “Enter” link on my websites welcome page, the link must open in a new window and the previous window must close itself. now getting a link to open in a new window is nothing to do but how do i get the previous page to close itself? So that when i hit enter, the new window appears and the old window closes.

I hope someone can help me out on this.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@TageOct 11.2004 — It's not ever going to work the way you want. A good rule to remember (although maybe not accurate) is that you cannot close windows you didn't open. With that said, you can try closing the window with window.close()
Copy linkTweet thisAlerts:
@javaNoobieOct 11.2004 — Do you mean that when you click 'Enter', you open up a new window and close the parent window(the window where u clicked 'Enter')? If so, you can try the following:
<i>
</i>window.open('page.htm','childWin','');
self.close();

NOTE: in IE they have a confirmation dialog on closing the parent window via script. If user clicks 'cancel', the parent window will not close. And you can't bypass that dialog box.
Copy linkTweet thisAlerts:
@stonexauthorOct 11.2004 — Thanks for the help. I thought that the dialog box would still be a problem. I'll try another method for my site.
×

Success!

Help @stonex 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.5,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...