OLD | NEW |
(Empty) | |
| 1 Screenshot Extension |
| 2 -------------------- |
| 3 |
| 4 This extension is to visually test the SDK examples. To use, add this to the |
| 5 html: |
| 6 |
| 7 TODO(binji): normal users shouldn't have to do this -- it should be |
| 8 automatically loaded by the testing framework. |
| 9 |
| 10 <head> |
| 11 ... |
| 12 <script |
| 13 src="chrome-extension://kbbhhngcmjcmlgcnbihfgliliemmijmj/screenshot.js"> |
| 14 </script> |
| 15 <head> |
| 16 |
| 17 Then in JavaScript: |
| 18 |
| 19 var myPluginEl = document.embeds[0]; |
| 20 function onSuccess(dataURL) { |
| 21 // dataURL is a data URL encoded PNG. You can add this to a image like this: |
| 22 var image = new Image(); |
| 23 image.onload = function() { ... } |
| 24 image.src = dataURL; |
| 25 } |
| 26 |
| 27 function onError(errorMessage) { |
| 28 ... |
| 29 } |
| 30 |
| 31 screenshot.captureElement(myPluginEl, onSuccess, onError); |
| 32 |
| 33 See screenshot.js for more info on the API. |
OLD | NEW |