| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <!-- | 3 <!-- |
| 4 Copyright (c) 2011 The Chromium Authors. All rights reserved. | 4 Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 5 Use of this source code is governed by a BSD-style license that can be | 5 Use of this source code is governed by a BSD-style license that can be |
| 6 found in the LICENSE file. | 6 found in the LICENSE file. |
| 7 --> | 7 --> |
| 8 <head> | 8 <head> |
| 9 <title>postMessage Example</title> | 9 <title>postMessage Example</title> |
| 10 <script> | 10 <script> |
| 11 | 11 |
| 12 function HandleMessage(message_event) { | 12 function HandleMessage(message_event) { |
| 13 if (message_event.data) { | 13 console.log("Received:"); |
| 14 alert("The string was a palindrome."); | 14 console.log(message_event.data); |
| 15 } else { | |
| 16 alert("The string was not a palindrome."); | |
| 17 } | |
| 18 } | 15 } |
| 19 | 16 |
| 20 function AddListener() { | 17 function AddListener() { |
| 21 var plugin = document.getElementById("plugin"); | 18 var plugin = document.getElementById("plugin"); |
| 22 plugin.addEventListener("message", HandleMessage, false); | 19 plugin.addEventListener("message", HandleMessage, false); |
| 23 } | 20 } |
| 24 document.addEventListener("DOMContentLoaded", AddListener, false); | 21 document.addEventListener("DOMContentLoaded", AddListener, false); |
| 25 | 22 |
| 26 </script> | 23 </script> |
| 27 </head> | 24 </head> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 42 | 39 |
| 43 <input type="text" id="inputBox" name="inputBox" value="ablewasiereisawelba"/> | 40 <input type="text" id="inputBox" name="inputBox" value="ablewasiereisawelba"/> |
| 44 <p> | 41 <p> |
| 45 <button onclick="SendString()">Is Palindrome</button> | 42 <button onclick="SendString()">Is Palindrome</button> |
| 46 <object id="plugin" type="application/x-ppapi-post-message-example" | 43 <object id="plugin" type="application/x-ppapi-post-message-example" |
| 47 width="1" height="1"/> | 44 width="1" height="1"/> |
| 48 <hr> | 45 <hr> |
| 49 </body> | 46 </body> |
| 50 </html> | 47 </html> |
| 51 | 48 |
| OLD | NEW |