1# Kiosk Mode 2 3If you have a real world kiosk application that you want to run on Google 4Chrome, then below are the steps to take to simulate kiosk mode. 5 6## Steps to Simulate Kiosk Mode 7 8### Step 1 9 10Compile the following Java code: 11 12```java 13import java.awt.*; 14import java.applet.*; 15import java.security.*; 16import java.awt.event.*; 17 18public class FullScreen extends Applet 19{ 20 public void fullScreen() 21 { 22 AccessController.doPrivileged 23 ( 24 new PrivilegedAction() 25 { 26 public Object run() 27 { 28 try 29 { 30 Robot robot = new Robot(); 31 robot.keyPress(KeyEvent.VK_F11); 32 } 33 catch (AWTException e) 34 { 35 e.printStackTrace(); 36 } 37 return null; 38 } 39 } 40 ); 41 } 42} 43``` 44 45### Step 2 46 47Include it in an applet on your kiosk application's home page: 48 49```html 50<applet name="appletFullScreen" 51 code="FullScreen.class" 52 width="1" 53 height="1"></applet> 54``` 55 56### Step 3 57 58Add the following to the kiosk computer's java.policy file: 59 60``` 61grant codeBase "http://yourservername/*" 62{ 63 permission java.security.AllPermission; 64}; 65``` 66 67### Step 4 68 69Include the following JavaScript and assign the `doLoad` function to the 70`onload` event: 71 72```javascript 73var _appletFullScreen; 74 75function doLoad() 76{ 77 _appletFullScreen = document.applets[0]; 78 doFullScreen(); 79} 80 81function doFullScreen() 82{ 83 if (_appletFullScreen && _appletFullScreen.fullScreen) 84 { 85 // Add an if statement to check whether document.body.clientHeight is not 86 // indicative of full screen mode 87 _appletFullScreen.fullScreen(); 88 } 89} 90``` 91