Roll src/third_party/WebKit 0c3f21f:4f9ce20 (svn 202223:202224)
[chromium-blink-merge.git] / docs / kiosk_mode.md
blob3c1789855d134bfd0fb62272e67cf2b0e50e982a
1 # Kiosk Mode
3 If you have a real world kiosk application that you want to run on Google
4 Chrome, then below are the steps to take to simulate kiosk mode.
6 ## Steps to Simulate Kiosk Mode
8 ### Step 1
10 Compile the following Java code:
12 ```java
13 import java.awt.*;
14 import java.applet.*;
15 import java.security.*;
16 import java.awt.event.*;
18 public class FullScreen extends Applet
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    }
43 ```
45 ### Step 2
47 Include it in an applet on your kiosk application's home page:
49 ```html
50 <applet name="appletFullScreen"
51         code="FullScreen.class"
52         width="1"
53         height="1"></applet>
54 ```
56 ### Step 3
58 Add the following to the kiosk computer's java.policy file:
60 ```
61 grant codeBase "http://yourservername/*"
63    permission java.security.AllPermission;
65 ```
67 ### Step 4
69 Include the following JavaScript and assign the `doLoad` function to the
70 `onload` event:
72 ```javascript
73 var _appletFullScreen;
75 function doLoad()
77    _appletFullScreen = document.applets[0];
78    doFullScreen();
81 function doFullScreen()
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    }
90 ```