How to set download location via chrome api

放肆的年华 提交于 2020-01-04 02:11:11

问题


I am using chrome.experimental.downloads.download() to download url, but I cannnot set downloads location. All the url downloaded to default location of chrome.

I have tired {url: xxxxxxxxxx, filename"\file\pic.jpg"}, but that didn't work.I don't known how to use chrome.experimental.downloads.setDestination() which might work.

Any hints?

Thanks~


回答1:


You currently cannot set the destination, it's not a function that is available in the API. The only mention I can find of setDestination is in an old Chromium ticket on this extension, but it seems that this functionality either never made it in to the current builds or is still being worked on.

The only thing you can do for now is set saveAs to true in the options object and let the user choose where to save it.

Update: I just checked the Chrome source code and in the current trunk version setDestination is marked as NOTIMPLEMENTED, so no joy on that one.



来源:https://stackoverflow.com/questions/11653361/how-to-set-download-location-via-chrome-api

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