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