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>
Related
I am writing a test automation framework using java and selenium.
I have a scenario where I have to check behaviour of web application when user has a device with no camera.
Is there any way to test this in laptop with camera?
Expected: navigator.mediadevices.enumerateDevices() should return null
Depending on your laptop, you could deactivate the device (camera). In Windows 10, the quickest way to do this is to go to the device manager and search for your camera. Right-click on it and then deactivate (or even remove, but that would require you to re-install the driver).
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.
I've recently noticed my build time has increased considerably, sometimes taking a full minute to load. On the console I still see "Building JavaScript bundle: finished" fairly quickly but the screen takes much longer to refresh. Is there a reason something like this would be happening?
Try using Expo in a Simulator on your development machine and determine if it is taking as long as on your device:
If it is faster than on your test device, then you should check the
network connection on your test device
If it is as slow as on the test device, then you could try to remove node_modules and reinstall them with 'npm install' or 'yarn'. Expo will be redownloaded aswell as all other packages.
In my case, it was a different solution.
I followed the instructions given by jimmylee on the Expo SDK forums, which say:
If you are behind a VPN, try disabling the VPN.
If you are using windows 10, run CMD on your machine and type
ipconfig. Take a look at the first Ethernet Adapter. If it doesn’t say
Ethernet Adapter Ethernet it means Expo is taking the IP address of
something else.
To fix this, go to network connections and disable the adapter that it
should not be pointing at.
Connect your computer to the network and your phone to the same
network. Restart Expo.
So, go to Settings > Network & Internet.
Click Change Adapter Options:
Then disable the unneeded Ethernet:
Then restart Expo.
If the connection is made but bundle building is very slow - Try disconnecting from the network both devices, the system and the mobile, and reconnect. Also, don't forget to clear the 'recently in development' projects and start the project again.
It will certainly increase the speed of building by far, especially for windows it works very well.
I was going through the same problem.
I used expo on multiple devices and clearly it depends on the device also, i.e, whether it is able to handle it or not.
Second, for the slow device, i came up with a solution.
I just turned off the fast Refresh.
Fast Refresh keeps a watch on the development side and keeps reloading whenever we make a change.
By deactivating it, we need to refresh the app on our own. But this helped me.
Due to multiple refreshes and continuous bundling, expo gets slow (as per me) thus disabling this feature may help (infact helped me a lot).
STEPS TO DO THAT;
In your expo go app, shake your device. An option panel will open.
There will be an option to disable fast refresh. Simply click that and you are done.
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.
I'm working on a webapp that's designed for use on large touchscreen monitors. It is not a mobile app; it will run in FireFox and Chrome on mac OS X and windows. I am looking for a way to programmatically pop up the OS's native on-screen keyboard from javascript. In Win 7, this happens automatically when the user focuses on a text area (just like iOS and Android), but for older versions of Windows and OS X, the user has to manually pull it up, which is a nuisance I would like to eliminate.
Ideally, it would work like Win7/iOS/Android and pop up automatically when the user focuses on a text area, but I'll settle for any javascript that pops up the keyboard, even if I have to add it for every text box.
If this is even possible, I'm sure it's different for Mac vs Windows, so I guess this is really two questions in one. Any help is appreciated.
OK, I've tested this locally on my own Mac (version 10.6.8) and Windows XP so the good news is that it works (and it is surprisingly easy).
The essential idea is:
Know how to open the on-screen keyboard from command line
Set up your browser to allow the command line to be executed from JavaScript
Write your HTML :-)
Instructions for both platforms are as follows.
Mac
For Mac, download and build this Xcode project:
https://github.com/nriley/keyboardViewer
Make sure your build target is the same as the client Mac (e.g. 64 bit Intel, etc). The output will be an executable file called keyboardViewer. This will pop open the on-screen keyboard when executed.
Let's assume you've saved keyboadViewer onto the user's Desktop then the command you will want to execute is (as in my case):
/Users/Oliver/Desktop/keyboardViewer.
Windows
On Windows, it is much easier to open the on-screen keyboard from the command line. The following (or similar) will do it:
C:\WINDOWS\system32\osk.exe
Firefox
Next, you are going to have to execute this file (or Windows command) from a browser. So, install the Firefox add-on here:
https://addons.mozilla.org/en-US/firefox/addon/commandrun/
This add-on will allow you to execute OS commands (e.g. execute files) from JavaScript. Before you can execute this from the add-on, you will need to add this command to the list of allowed commands.
To do this, go to about:config in the browser address bar. Right click on the list of preferences and select New > String. The name of the new preference you want to add is extensions.commandrun.allowedcommands. For the value, enter the following:
On Mac: ["/Users/Oliver/Desktop/keyboardViewer"]
On Windows: ["C:\\WINDOWS\\system32\\osk.exe"]
HTML
Now, you will be able to open the on-screen keyboard from Firefox with HTML like this:
<script language="javascript">
function openKeyboard(){
CommandRun.run("/Users/Oliver/Desktop/keyboardViewer", []);
}
</script>
<input type="text" onfocus="javascript:openKeyboard();" />
On Windows, substitute the following:
CommandRun.run("C:\\WINDOWS\\system32\\osk.exe", []);
Alternative
An alternative is to write your own browser in something like Adobe Air. Using that method, your JavaScript calls your Air app and your Air app then executes keyboardViewer (or the Windows equivalent).