I'm producing a page which will most often be opened via an anchor with target="_blank"
.
Progressive enhancement AJAXes in the page and places it within a modal, in which case the close button removes the modal node from the tree — in these situations a 'pop out' link will feature, allowing the user to open the page in a separate window (as above). It's easy enough to figure out whether this should be displayed or not based on the tree structure:
.modal a.pop-out {
display: none;
}
In both these situations, a close link is also appropriate in the same context: because the user journey has taken a momentary detour, it's expected that the user will sooner or later want to close the window and return to the opening window. However, I can't work out what feature detection to use to determine whether or not the link should be displayed. Obviously javascript support is necessary, but if the link was opened independently and javascript is supported, the close button is not appropriate (window.close()
will have no effect).
My question the, is how I can work out, without executing it, whether window.close
is possible in the current context.