| OLD | NEW |
| (Empty) | |
| 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 This example just uses postMessage to tell the plugin to fetch a file. |
| 9 The plugin will echo the contents of that file back to us and we'll display |
| 10 it on the page. |
| 11 --> |
| 12 <head> |
| 13 <title>URLLoader Example</title> |
| 14 <script> |
| 15 |
| 16 function HandleMessage(message_event) { |
| 17 document.getElementById("log_result").innerHTML = message_event.data; |
| 18 } |
| 19 |
| 20 function AddListener() { |
| 21 var plugin = document.getElementById("plugin"); |
| 22 plugin.addEventListener("message", HandleMessage, false); |
| 23 } |
| 24 document.addEventListener("DOMContentLoaded", AddListener, false); |
| 25 |
| 26 </script> |
| 27 </head> |
| 28 |
| 29 <body> |
| 30 <script> |
| 31 |
| 32 function StartRequest() { |
| 33 var plugin = document.getElementById("plugin"); |
| 34 var inputBox = document.getElementById("inputBox"); |
| 35 plugin.postMessage("go"); |
| 36 } |
| 37 |
| 38 </script> |
| 39 |
| 40 <p>This test must be run over HTTP. If you're a Chrome developer, see the |
| 41 README_chrome_developer.txt in this directory for how to run.</p> |
| 42 |
| 43 <button onclick="StartRequest()">Start request</button> |
| 44 <object id="plugin" type="application/x-ppapi-url-loader-example" |
| 45 width="1" height="1"> |
| 46 </object> |
| 47 <hr> |
| 48 <div id="log_result" style="background-color:#EEE; border:1px solid black;"> |
| 49 <i>Result will go here...</i> |
| 50 </div> |
| 51 </body> |
| 52 </html> |
| 53 |
| OLD | NEW |