Here's the code snippet: ``` var iframe = document.createElement('iframe'); document.body.appendChild(iframe); var fn = () => { iframe.remove(); console.log('error'); }; var doc = iframe.contentDocument; doc.open(); doc.close(); iframe.addEventListener('load', fn, true); iframe.src = "https://www.seattlesymphony.org/~/media/files/notes/schubert-sonata-21-b-flat.pdf"; ``` `iframe.src` can be replaced with any `Content-Disposition: attachment`
Bug 1575799 Comment 16 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Here's the code snippet: ```js var iframe = document.createElement('iframe'); document.body.appendChild(iframe); var fn = () => { iframe.remove(); console.log('error'); }; var doc = iframe.contentDocument; doc.open(); doc.close(); iframe.addEventListener('load', fn, true); iframe.src = "https://www.seattlesymphony.org/~/media/files/notes/schubert-sonata-21-b-flat.pdf"; ``` `iframe.src` can be replaced with any `Content-Disposition: attachment`