OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <script> | 3 <script> |
4 function triggerPrompt() { | 4 function triggerPrompt() { |
5 document.getElementById('flash-link').click(); | 5 document.getElementById('flash-link').click(); |
6 window.domAutomationController.send(true); | 6 window.domAutomationController.send(true); |
7 } | 7 } |
8 | 8 |
9 function triggerPromptViaNewWindow() { | 9 function triggerPromptViaNewWindow() { |
10 document.getElementById('flash-new-window-link').click(); | 10 document.getElementById('flash-new-window-link').click(); |
11 window.domAutomationController.send(true); | 11 window.domAutomationController.send(true); |
12 } | 12 } |
13 | 13 |
14 function flashIsEnabled() { | 14 function flashIsEnabledForPlugin(plugin) { |
15 var plugin = document.getElementById('flash-object'); | |
16 plugin.addEventListener('message', function handleEvent(event) { | 15 plugin.addEventListener('message', function handleEvent(event) { |
17 if (event.data.source === 'getPowerSaverStatusResponse') { | 16 if (event.data.source === 'getPowerSaverStatusResponse') { |
18 plugin.removeEventListener('message', handleEvent); | 17 plugin.removeEventListener('message', handleEvent); |
19 window.domAutomationController.send(true); | 18 window.domAutomationController.send(true); |
20 } | 19 } |
21 }); | 20 }); |
22 if (plugin.postMessage) { | 21 if (plugin.postMessage) |
23 plugin.postMessage('getPowerSaverStatus'); | 22 plugin.postMessage('getPowerSaverStatus'); |
24 } else { | 23 else |
25 window.domAutomationController.send(false); | 24 window.domAutomationController.send(false); |
26 } | 25 } |
| 26 |
| 27 function flashIsEnabled() { |
| 28 flashIsEnabledForPlugin(document.getElementById('flash-object')); |
| 29 } |
| 30 |
| 31 function flashIsEnabledForPluginWithoutFallback() { |
| 32 flashIsEnabledForPlugin( |
| 33 document.getElementById('flash-object-no-fallback')); |
27 } | 34 } |
28 </script> | 35 </script> |
29 <body> | 36 <body> |
30 <object id="flash-object" name="plugin" data="test.swf" | 37 <object id="flash-object-no-fallback" data="test.swf" |
| 38 type="application/x-shockwave-flash" width="400" height="100"> |
| 39 </object> |
| 40 <object id="flash-object" data="test.swf" |
31 type="application/x-shockwave-flash" width="400" height="100"> | 41 type="application/x-shockwave-flash" width="400" height="100"> |
32 Flash not supported. | 42 Flash not supported. |
33 <br> | 43 <br> |
34 <a href="https://get.adobe.com/flashplayer/" id="flash-link"> | 44 <a href="https://get.adobe.com/flashplayer/" id="flash-link"> |
35 Download Flash. | 45 Download Flash. |
36 </a> | 46 </a> |
37 <a id="flash-new-window-link" | 47 <a id="flash-new-window-link" |
38 onclick="window.open('https://get.adobe.com/flashplayer/');"> | 48 onclick="window.open('https://get.adobe.com/flashplayer/');"> |
39 Download Flash window.open | 49 Download Flash window.open |
40 </a> | 50 </a> |
41 </object> | 51 </object> |
42 </body> | 52 </body> |
43 </html> | 53 </html> |
OLD | NEW |