|
OLD | NEW |
---|---|
(Empty) | |
1 <body> | |
polina
2011/03/22 22:00:59
no html, title, etc?
dmichael(do not use this one)
2011/03/23 17:03:18
Sorry, was just copying the ppapi/example/example.
| |
2 | |
3 <script type="text/javascript"> | |
4 | |
5 function SendString() { | |
6 plugin = document.getElementById('plugin'); | |
7 | |
8 // If we haven't already done it, set up an 'onmessage' function. This will | |
9 // get invoked whenever the plugin calls Instance::PostMessage in C++ (or | |
10 // PPB_Instance::PostMessage in C). In this case, we're expecting a bool to | |
polina
2011/03/22 22:00:59
PPB_Messaging
dmichael(do not use this one)
2011/03/23 17:03:18
Done.
| |
11 // tell us whether the string we passed was a palindrome. | |
12 if (!plugin.onmessage) { | |
13 plugin.onmessage = function(message_event) { | |
14 if (message_event.data) { | |
15 alert("The string was a palindrome."); | |
16 } else { | |
17 alert("The string was not a palindrome."); | |
18 } | |
19 } | |
20 } | |
21 | |
22 var inputBox = document.getElementById("inputBox"); | |
23 | |
24 // Send the string to the plugin using postMessage. This results in a call | |
25 // to Instance::HandleMessage in C++ (or PPP_Instance::HandleMessage in C). | |
polina
2011/03/22 22:00:59
PPP_Messaging
dmichael(do not use this one)
2011/03/23 17:03:18
Done.
| |
26 plugin.postMessage(inputBox.value); | |
27 } | |
28 | |
29 </script> | |
30 | |
31 <input type="text" id="inputBox" name="inputBox" value="ablewasiereisawelba"/> | |
32 <p> | |
33 <button onclick='SendString()'>Is Palindrome</button> | |
34 <object id="plugin" type="application/x-ppapi-post-message-example" | |
35 width="0" height="0"/> | |
36 <hr> | |
37 </body> | |
OLD | NEW |