Skip to content

Instantly share code, notes, and snippets.

@AdeptSEO
Forked from sfrdmn/image_downloader.js
Created October 17, 2023 14:10
Show Gist options
  • Save AdeptSEO/c55967383ad48ff51b60cc948b83437a to your computer and use it in GitHub Desktop.
Save AdeptSEO/c55967383ad48ff51b60cc948b83437a to your computer and use it in GitHub Desktop.
Bookmarklet to download all images on a page
;(function() {
var images = [].slice.call(document.querySelectorAll('img'))
try {
images.forEach(function(img) {
downloadImage(img)
})
} catch (e) {
alert("Download failed.");
console.log('Download failed.', e);
}
function downloadImage(img) {
var link = document.createElement('a')
link.setAttribute('href', img.src)
link.setAttribute('download', '')
link.click()
}
}).call(window);
javascript:;(function() {var images = [].slice.call(document.querySelectorAll('img'));try {images.forEach(function(img){downloadImage(img)})} catch (e) {alert('Download failed.');console.log('Download failed.', e)}function downloadImage(img) {var link = document.createElement('a');link.setAttribute('href', img.src);link.setAttribute('download', '');link.click()}}).call(window);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment