javascripthtmlwebwebbrowser-controlshutdown

Shutdown computer via web page


I have web based application which automatically loads on kiosk mode (full-screen) in chromium web browser on client's Computer wich is powered by Windows 7. I want to place a shutdown button on web page, so that user can directly shutdown the computer.

-P.S-

I've full control over client's computer. (installing other software or browser extensions). it is a touch screen POS unit.


Solution

  • As you have control over the target machine, this is completely feasible. One way to do it is by introducing a separate component to perform the shutdown.

    1. Create a console application (using C#, for example) that listens to stdin, that shuts down the machine when it receives the right input. Machine shutdown from C# is not entirely trivial, but Stackoverflow knows how it is done.

    2. Register this application with a proper manifest given the Google Chrome Native Messaging specification.

    3. Call this extension from your webpage (on shutdownButton.click(), for instance) using Message Passing.

    The individual steps are a bit too broad to fully detail them in a single answer, but you can always open new questions on them if they give you any trouble.