- If so then close it in onLoad. (grin) ESC processing isn't required.
- If you want ESC processing in your window then Mike's suggestion should be the ticket.
- If you want ESC processing in some particular place then Mike's suggestion is still the ticket. The difference is the dojo.connect should be applied to whatever DOM element you want the ESC processing on. For instance, I have similar code that attaches an event handler to a dijit underlay, so ESC will dismiss the current dialog. Works a treat.
EDIT: I see now this is a repost of a prior question where you want window.close to close the MAIN window. You can't. This has not one thing to do with XPages, any version. It's a browser issue. You can close dependent pop-up windows all day with window.close(), but it's impossible to FORCE the main window to close. Only the user can do that.
Hope this helps...