Does chrome extension api support downloads directly from browsing cache?

孤人 提交于 2019-12-13 13:27:50

问题


I'm implementing a simple web picture grabber, using chrome.downloads api.

I grab the image urls in content script, and then call chrome.downloads.download to download them in the background script. It works well, but I want it faster.

I find that if users click "save image as" in the context menu of <img> object, the downloading speed is very fast and almost seamless. I think it downloads directly from cache.

However, using chrome.downloads seems independent of the loading of <img> objects; even though pictures are already loaded on the webpage, chrome.downloads.download takes some time to download each image, not so fast as "save image as". So I think it download from the url, regardless of cache.

In fact, doing so has each picture downloaded twice: one to cache to browser display, the other to download folder. It's clearly a waste of time and net resource.

So... back to the topic: is there any api supporting downloading directly from the chrome's browsing page? Just like "save image as".


回答1:


I have asked the same question before. Chrome APIs for the public is really backward. They don't really have most features the browser offers.

In short, no, you cannot. "Save image as" is the only way you can access the cache and save them to another location on your disk.



来源:https://stackoverflow.com/questions/22691443/does-chrome-extension-api-support-downloads-directly-from-browsing-cache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!