closing a page when returning

  User-CB94CED6-F3AA-42E7-8A286564F5DCBC14 20:16 10 Nov 2006

In one of my main webpages on the sidebar I have a link to a gallery page which opens a new window. I have a "Return" button which I want to take me back AND at the same time close the opened window.

Can someone advise on the best standards way of doing this? If javascript is recommended what is the default if js turned of in the client browser?

Many thanks

  Eric10 15:51 11 Nov 2006

Surely if your gallery opens in a new window then you only need to close that window and the page that launched it will still be open under it. If so you only need a close button rather than a return button. Or have I misunderstood?

I want a standard 'link' type looking close 'button' e.g. 'Return' (underlined) but do not know what the html code is. I would like it to be xhtml srict.

  Eric10 12:15 12 Nov 2006

To close a window when it has been opened from a link: <a href="javascript:window.close();">Close this window to return to the site</a>
Replace the text within the link with the code for your 'Return' button.

As far as I am aware there is nothing in standard HTML to close a Window. For browsers with Javascript turned off you could add a message asking them to close the window with the 'X' at top right of the window.

  PurplePenny 13:58 12 Nov 2006

If you are using JavaScript you will have to add a <noscript> anyway so put Eric's suggested message in there.

You should warn users that the gallery opens in an new window. I'm not sure about the accessibility of using "return": the user isn't really returning since the originating page is still there. As Eric as already said it is really closing not returning.

Hmm, a sudden thought: if you are using Strict then presumably you are opening the gallery with JavaScript so you will already have had to consider users with JavaScript turned off. How are you handling that?

Yes I am using js. The text I will use will be "close window". I have text on hover which sais "opens in new window if Javascript enabled". If no javascript then it opens in the same window. The reason why I'm opening new windows is because the site has brochures and other docs for the viewer and this is handy if the viewer wants to keep the doc open and still refer to the mother page. Need to think a bit more about this though, as I need to test what happens if the viewer opens multiple docs and then starts closing some down - do'nt want things to get confused! Comment welcome.

PS I'm reading a book on accessibility and this has some javascript to open a new window in a supposedly accessible way.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Dell XPS 13 9370 (2018) review

No need to scan sketches into your computer with Moleskine's new smart pen

How to use 3D Touch on iPhone

Comment importer des contacts d’un iPhone à un autre iPhone ?