Removed Polymer elements depending on web-animations-js.
[chromium-blink-merge.git] / ppapi / examples / scripting / post_message.html
blob46e0c347173f2958df4c0cc69a36b3906e63c504
1 <!DOCTYPE html>
2 <html>
3 <!--
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
6 found in the LICENSE file.
7 -->
8 <head>
9 <title>postMessage Example</title>
10 <script>
12 function HandleMessage(message_event) {
13 if (message_event.data) {
14 alert("The string was a palindrome.");
15 } else {
16 alert("The string was not a palindrome.");
20 function AddListener() {
21 var plugin = document.getElementById("plugin");
22 plugin.addEventListener("message", HandleMessage, false);
24 document.addEventListener("DOMContentLoaded", AddListener, false);
26 </script>
27 </head>
29 <body>
30 <script>
32 function SendString() {
33 var plugin = document.getElementById("plugin");
34 var inputBox = document.getElementById("inputBox");
36 // Send the string to the plugin using postMessage. This results in a call
37 // to Instance::HandleMessage in C++ (or PPP_Messaging::HandleMessage in C).
38 plugin.postMessage(inputBox.value);
41 </script>
43 <input type="text" id="inputBox" name="inputBox" value="ablewasiereisawelba"/>
44 <p>
45 <button onclick="SendString()">Is Palindrome</button>
46 <object id="plugin" type="application/x-ppapi-post-message-example"
47 width="1" height="1"/>
48 <hr>
49 </body>
50 </html>