Windows shutdown or logoff from browser - javascript

I understand the potential security consequences of allowing shutdown or logoff from a browser, but I have an application running in a locked down 'kiosk' mode, and would like to be able to offer the user a shutdown or logoff option.
Is it possible to tell Windows to logoff or shutdown from Javascript within a browser?

Sorry JavaScript cannot do this. You're best bet is if the user's browser encounters a unique glitch, thus restarting their computer. I remember I once had a program that always glitched out in Internet Explorer (I don't recall if it was 5.0 or 6.0) and restarted the user's computer. Sorry I don't recall the code but it had something to do with void and a for in loop.

Related

How to detect. Through javascript if VirtualBox is open

I would like to ask. Is it possible to make a web script that can detect if the user is running VirtualBox/Virt-Manager. Note that I am not asking to determine whether the OS is in a VM. I am talking about a situation when the OS is running on the host PC and the web master wants to take an action IF the user have one of those VM programs installed and open with VM's running.

Shutting down Chromium kiosk mode

I'm running an app on arch linux that is using chromium in kiosk mode. There is no keyboard attached as its relying on touch screen, so there isn't a way to 'break out' of chromium to a terminal to shut the computer down that way. So whats the best way to shut the computer down other than just cutting the power supply. I've tried using node to exec a shut down command but without success.
Thanks,
Adam
SSH into the kiosk and shutdown from there. You will need some way to
bring the machine back up though - could be either WoL (wake on LAN)
or physical power button on the machine.
Press the power button on the machine to shut down - this does
require physical access though.
It's impossible to shut down the computer with JavaScript as no such communication exists with the OS.
The best that JavaScript can offer you is to close the Kiosk window with a...
window.parent.close();
So if you want to add such a touch button you can use something like this...
<div ontouchstart="window.parent.close();">Close this window</div>

Why Google Chrome does not delete session cookie when restart after crash?

My web page set a session cookie when the user is connected.
If i kill the chrome process on windows, and then i restart the browser, my session cookie is here ! Why ?
Is there a way to prevent this behaviour ?
This is a feature, not a bug. Crashes usually are not intentional, and it would be a huge inconvenience to the user to have to log into everything all over again.
Crashing is not the same as exiting. If you want to restart the browser, quit it the normal way, not by killing it.

Prevent window.stop to block open websockets

I have a Websocket-based client-server communication protocol, which must be cross-browser compatible.
To prevent some MJPEG streams from running indefinitely on Safari and Chrome as described in this bug report, I launch a window.stop() javascript event under certain conditions.
On Chrome this keeps the websocket connection open, which is good.
On Firefox, however, the websocket is abruptly closed.
Is there a way to force some sockets to stay open with the window.stop() event?
The only workaround, otherwise, would be to use some browser sniffing (bad practice) or to hope that Chrome devs will finally debug the MJPEG issue (which is unlikely).

Problem with DWR and Android-Browser

I am experiencing a problem with accessing an application from the Android-browser.
The application uses DWR to persist connections to the clients that are connected with it.
Everything works fine for me, except that if the application does not send any data to the client on the Android-phone for 2 minutes, the connection seems to be lost and no data arrive at the client. The same scenario works just fine on Firefox, Opera and Chrome. If the pause between two data transfers is less than 2 minutes, it works just fine.
So, now my question:
Is there some timeout setting for the android browser that I am missing? Or is this some built-in bug/feature/whatever that I cannot circumvent?
I know that I could prevent this from happening with some sort of heartbeat, I would just like to why this is happening.
Thanks in advance, Max
btw: Everything (server, clients) runs on my machine and I am testing this on the android emulator with Windows XP
Android emulator version 1.10 (build_id CUPCAKE-150240)
Could it be that the Android system is garbage collecting your activity and thus loosing your web browser and closing the persistent connection?
Perhaps you could check this by looking in you logcat (on android end) or webserver logs (on remote end)?
if this is the case, you would need to add reconnect code into the onresume/onstart method in android.

Categories