获取通过Chrome扩展名下载的文件的绝对路径 [英] Getting the absolute path of file downloaded through a chrome extension

查看:128
本文介绍了获取通过Chrome扩展名下载的文件的绝对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一种从网页下载特定文件的Chrome扩展。我有一个popup.html,通过它可以输入要下载的文件的名称,还有一个链接历史记录,单击我想打开一个新页面,其中包含以前下载的文件(下载历史记录)的链接。

I am developing a chrome extension which downloads particular files from webpages. And I have a popup.html through which I can enter a name for the file to be downloaded and also a link "History" on clicking which I would like to open a new page with links to previously downloaded files(Download history).

我可以下载文件,但无法找出如何显示下载记录。如果我可以获得文件下载的绝对路径,我可以把它放在新页面中作为一个链接。当我们点击时,本地浏览器会执行其他操作(显示下载路径中的文件)。任何帮助将不胜感激。

I am able to download files but I am unable to figure out how to show the download history. If I could get the absolute path of the file download, I can just put it in the new page as a link. And when we click that the local browser would do the rest(Show the files present in the downloads path).Any help would be appreciated.

推荐答案

根据 chrome.downloads.DownloadItem ,您可以使用

chrome.downloads.DownloadItem.filename

获得绝对的本地路径。

这篇关于获取通过Chrome扩展名下载的文件的绝对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆