subframe-that-posts-html-containing-blob-url-to-parent.html (460B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <script> 4 fetch('html-correctly-labeled.html') 5 .then(response => response.blob()) 6 .then(blob => { 7 let msg = { blob_size: blob.size, 8 blob_type: blob.type, 9 blob_url: URL.createObjectURL(blob) }; 10 window.parent.postMessage(msg, '*'); 11 }) 12 .catch(error => { 13 let msg = { error: error }; 14 window.parent.postMessage(msg, '*'); 15 }); 16 </script>