download-inner.html (1028B)
1 <!DOCTYPE html> 2 <html> 3 4 <head> 5 <title>The page triggering download embedded as a Fenced Frame</title> 6 <script src="download-helper.js"></script> 7 <script src="utils.js"></script> 8 <script> 9 window.addEventListener('DOMContentLoaded', async () => { 10 const [download_key, download_ack_key] = parseKeylist(); 11 const type = new URL(location).searchParams.get('type'); 12 const href = `download-stash.py?token=${download_key}`; 13 14 if (type == 'anchor') { 15 // This link will be clicked in the main frame. 16 // See: ../download.https.html 17 const anchor = document.querySelector('#download'); 18 anchor.href = href; 19 } else { 20 const delay = StreamDownloadFinishDelay(); 21 location.href = `${href}&finish-delay=${delay}` 22 } 23 24 await writeValueToServer(download_ack_key, 'Triggered the action for download'); 25 }); 26 </script> 27 </head> 28 29 <body> 30 <a style="position: absolute; width: 100%; height: 100%;" id="download" 31 download>Download</a> 32 </body> 33 34 </html>