Setting a default html download code for different images from a web site | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Setting a default html download code for different images from a web site

I want to set default download html codes for different images from the inspect window (Ctrl+shift+I) in webpage.i want to add a html download option which is possible but I cannot set a default download option for different images..please help me..thanks

22nd Apr 2017, 2:32 PM
Roshan Muralidharan
Roshan Muralidharan - avatar
1 Answer
+ 6
You can use an iperlink: <a id="dLink"></a> And create a function for the download, try modifying this one, passing the image as parameter. function saveFile() { var Tarea = document.getElementById("Tarea").value; var TareaBlob = new Blob([Tarea], {type:"text/plain"}); var dLink = document.getElementById("dLink"); dLink.download = document.getElementById("IfileName").value; dLink.href = window.URL.createObjectURL(TareaBlob); dLink.click(); } At least coll the function for all the images.
29th Apr 2017, 8:39 PM
Emore Anzolin
Emore Anzolin - avatar