Hi,
I have a pop-up box that displays some information. I want to close this pop-up and return to my original window using window.close(), but I want to return to a specific section on the original page using an anchor. Is it possible to do this?
Thank you.
Leave the anchor as you had it... although some browsers might require there to be some content between the tags (a non breaking space works if you see this happening).
Next make a minor change to your link on the initial page (this prevents the actual page from trying to load the # url). Basically I have added a return false in the javascript section (to prevent the link from opening normally) and added the real link to defs.htm (in case they don't have javascript enabled this will at least let them open the link):
Code:
<a href="defs.htm" onClick="window.open('defs.htm','layout','toolbar=no,menubar=no,scrollbars=yes'); return false;" style="text-decoration:underline; font-weight:normal; color:#333399">Open new window</a>
There is a final change to the close window link on the defs.htm file. This is some javascript that is run before the popup window is closed. I added a (mock) link to the href so that non javascript users will still be able to use your solution (up to you of course if you choose to support these users):
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.