How can I close a specific browser window under linux
May 5, 2008 9:19 AM
Subscribe
Can I control a browser from an application under linux.
My application has an option to run as an http server, and kick off a browser that points to itself using (for example) /usr/bin/mozilla.
I want to add a quit button to the generated html, which tells the application to quit serving, then closes the browser, window, or tab that was created.
Obviously I dont want to quit any other windows or tabs if the user is doing something else at the time.
Stopping the server is no problem, but I'm hitting a roadblock closing down the browser side. Javascript wont let me close the current window, and I cant find any command line options to mozilla that let me do what I want.
Is there something I'm missing, or a better approach to the problem?
posted by yetanother to computers & internet (6 comments total)
You could have the "quit" button send a signal to the backend daemon you've written, which would read the process ID Firefox got started as (since it started it!) and send a kill signal to it.
The big wrinkle is that they may very well have opened other tabs and be irritated. I think it may be better design to just display a, "The server has been stopped. You may now close your browser window" message. I don't know the specifics, but I'd be annoyed if the browser just closed.
posted by fogster at 9:36 AM on May 5