Forum Moderators: open
When opening a new "target" window, it opens a new window while leaving the old window still open. I want to close the window.
the scenario: MainPage has a link that opens a new window named "New1". Window New1 has a link that opens a new window named "New 2". Now I want a link on page New 2 to open a new page in window "New1" (which is already open) while at the same time closing itself (window "New2").
Is there any way to do that [in the "HREF" tag]?
Joseph
The "#" represents the new url. Do I need "Target=New1" so it will replace the contents in window New1 which is already open?
Also is 'newpage.html' the actual syntax or should I substitude the url of the page that's open in window New2 ...the one I want to close?
What am I reading incorrectly?
I've tried all the possible combinations and can't get it right. :(
You can put the url in place of the # - that's in addition to, and not in place of, the javascript. This would give you spiderable pages, and some functionality for people whol don't have javascript for whatever reason.
<a href="newpage.html" onclick="window.opener.parent.location='newpage.html';window.close();return false;">
Essentially, the javascript says "When this link is clicked --
1) load newpage.html in the window that opened this one;
2) close this window;
3) ignore the regular href attribute in the html anchor tag;"
There may well be other javascript approaches - I only know a little bit and I'm sure the folks in our Javascript Forum [webmasterworld.com] would be glad to help further.
From my understanding, you can just <a href="javascript:window.close();">Link</a> on page New 2. It will close itself, leaving you window New1 that's already opened.
Here's the deal. Window new2 might be opened from window new1 "OR" it may be open from another source. If window new1 were not the source, it's necessary for it to open window new1 ....so you can see just closing the window is not the answer.
I did post the question to the javascript forum as you suggested.