Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <script> | |
| 4 function triggerPrompt() { | |
| 5 document.getElementById('flash-link').click(); | |
| 6 window.domAutomationController.send(true); | |
| 7 } | |
| 8 | |
| 9 function flashIsEnabled() { | |
| 10 var plugin = document.getElementById('flash-object'); | |
| 11 function handleEvent(event) { | |
| 12 if (event.data.source === 'getPowerSaverStatusResponse') { | |
| 13 plugin.removeEventListener('message', handleEvent); | |
| 14 window.domAutomationController.send(true); | |
| 15 } | |
| 16 } | |
| 17 plugin.addEventListener('message', handleEvent); | |
|
tommycli
2016/09/26 22:54:49
nit: I've seen this cool pattern recently:
plugin
raymes
2016/09/27 04:05:41
Cool, thanks!
| |
| 18 if (plugin.postMessage) { | |
| 19 plugin.postMessage('getPowerSaverStatus'); | |
| 20 } else { | |
| 21 window.domAutomationController.send(false); | |
| 22 } | |
| 23 } | |
| 24 </script> | |
| 25 <body> | |
| 26 <object id="flash-object" name="plugin" data="test.swf" | |
| 27 type="application/x-shockwave-flash" width="400" height="100"> | |
| 28 Flash not supported. | |
| 29 <br> | |
| 30 <a href="https://get.adobe.com/flashplayer/" id="flash-link">Download Flash. </a> | |
|
tommycli
2016/09/26 22:54:49
need line wrap here?
raymes
2016/09/27 04:05:41
Done.
| |
| 31 </object> | |
| 32 </body> | |
| 33 </html> | |
| OLD | NEW |