5 ms·
> I know bookmarklets basics. What I wanted to know is which API calls you used inside of the < 2000 character bookmarklet to achieve the functionality you desc
by johndough 6y ago
> I know bookmarklets basics. What I wanted to know is which API calls you used inside of the < 2000 character bookmarklet to achieve the functionality you described.
To create the archive data, I used an Uint8Array where I wrote the bytes into.
To download the images, I used XMLHttpRequest.
> I also believed that the bookmarklets are limited to the security context of the web page
That seems to be true unfortunately. However, besides the images on the same domain, it should also be possible to download some more images from other domains by allowing cross origin requests if the remote server cooperates and sets the respective header. but I have not looked into that yet.
The bookmarklet is here if you have more questions: https://github.com/983/FileDownloader https://github.com/983/FileDownloader
It is a bit larger than 2500 characters now since previously the code was optimized for size. Now it is slightly more readable.