download_page.html (1194B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=676619 5 --> 6 <head> 7 8 <title>Test for the download attribute</title> 9 10 </head> 11 <body> 12 hi 13 14 <script> 15 const host = window.location.host; 16 const path = location.pathname.replace("download_page.html","download_server.sjs"); 17 18 const secureLink = document.createElement("a"); 19 secureLink.href=`https://${host}/${path}`; 20 secureLink.download="true"; 21 secureLink.textContent="Secure Link"; 22 secureLink.id="secure"; 23 24 const insecureLink = document.createElement("a"); 25 insecureLink.href=`http://${host}/${path}`; 26 insecureLink.download="true"; 27 insecureLink.id="insecure"; 28 insecureLink.textContent="Not secure Link"; 29 30 const insecureSVG = document.createElement("a"); 31 insecureSVG.href=`http://${host}/${path}?type=image/svg+xml&name=example.svg`; 32 insecureSVG.download="true"; 33 insecureSVG.id="insecureSVG"; 34 insecureSVG.textContent="Not secure Link to SVG"; 35 36 document.body.append(insecureSVG); 37 document.body.append(secureLink); 38 document.body.append(insecureLink); 39 </script> 40 </body> 41 </html>