OLD | NEW |
---|---|
1 <script type="text/javascript"> | 1 <script type="text/javascript"> |
2 function SetSrc(src) { | 2 function SetSrc(src) { |
3 plugin = document.getElementById('plugin'); | 3 plugin = document.getElementById('plugin'); |
4 plugin.src = src; | 4 plugin.src = src; |
5 } | 5 } |
6 function SetSize(w, h) { | 6 function SetSize(w, h) { |
7 plugin = document.getElementById('plugin'); | 7 plugin = document.getElementById('plugin'); |
8 plugin.width = w; | 8 plugin.width = w; |
9 plugin.height = h; | 9 plugin.height = h; |
10 } | 10 } |
11 function PostMessage(data) { | |
12 plugin = document.getElementById('plugin'); | |
13 plugin.postMessage('testing123', ''); | |
nasko
2012/09/19 21:19:59
The second param is the target origin, right? If y
| |
14 } | |
11 </script> | 15 </script> |
12 | 16 |
13 <object id="plugin" | 17 <object id="plugin" |
14 tabindex="0" | 18 tabindex="0" |
15 type="application/new-browser-plugin" | 19 type="application/new-browser-plugin" |
16 width="640" | 20 width="640" |
17 height="480" | 21 height="480" |
18 border="0px"></object> | 22 border="0px"></object> |
23 <script type="text/javascript"> | |
24 var msg; | |
25 function receiveMessage(event) { | |
26 msg = event.data; | |
27 if (msg != 'stop_ack') { | |
nasko
2012/09/19 21:19:59
Shouldn't that be !==?
Fady Samuel
2012/09/20 15:24:28
Done.
| |
28 event.source.postMessage('stop', '*'); | |
29 } else { | |
30 window.document.title = 'stop_ack'; | |
31 } | |
32 } | |
33 document.getElementById('plugin').addEventListener('message', receiveMessage, fa lse); | |
34 </script> | |
OLD | NEW |