click a button,then close browser?

may i put a button in echo3 app, just want:click this button,then browser close.
thanks.

tliebeck's picture

Assuming you're writing in

Assuming you're writing in server-side Java, you'd want to create a custom Command implementation to do this. Take a look at the implementation of the BrowserRedirectCommand:

https://svn.nextapp.com/svn/echo3/trunk/src/server-java/webcontainer/nextapp/echo/webcontainer/command/BrowserRedirectCommand.java

and its peer:

https://svn.nextapp.com/svn/echo3/trunk/src/server-java/webcontainer/nextapp/echo/webcontainer/sync/command/BrowserRedirectCommandPeer.java

and its client-side script:

https://svn.nextapp.com/svn/echo3/trunk/src/server-java/webcontainer/nextapp/echo/webcontainer/resource/RemoteClient.BrowserRedirect.js

Your client-side script would just call window.close().

The one caveat is that most all browsers won't close a window/tab that you did not programmatically open. So unless you invoked window.open() previously to create the window, you're not allowed to close it.