通过Google Chrome扩展程序访问本地文件? [英] Access local files through Google chrome extension?

查看:1066
本文介绍了通过Google Chrome扩展程序访问本地文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从本地文件
中加载一个名称列表到我的谷歌浏览器扩展中。这怎么办?如果该文件与扩展本身一起提供,那该怎么办? 解决方案

在后台页面中使用 XMLHttpRequest (使用相对路径, / 为扩展根文件夹)。



你也可以将你的文件设为javascript( var config = [...] ),并用<$ c $加载它c>< script> 放入后台页面。


I need to load a list of names into my google chrome extension from a local file, How can this be done? what if the file is shipped with the extension itself?

解决方案

If this file is shipped with your extension then you can just load it with XMLHttpRequest inside background page (use relative paths, with / being extension root folder).

You can also make your file to be javascript (var config=[...]) and just load it with <script> into background page.

这篇关于通过Google Chrome扩展程序访问本地文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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