如何在浏览器扩展中使用本地JSON?

发布于 2025-02-06 18:32:39 字数 346 浏览 1 评论 0原文

我迷失了不可思议的浏览器扩展名。我正在做一个与龙有关的。通常,我只会使用FS,但这不是一个选择,因为它不是节点。

我的浏览器扩展文件夹只有三个文件:subtest.jsoncontent-script.jsDragons.json。我正在用content-script.js进行扩展,并且它正在游泳,但是现在我想从并写入Dragons.json.json。我的扩展名不会出版或用于任何其他用户,而只能使用我。如何访问此文件?我并不是要读取用户的文件,也不是任何外部在线文件,而只是存储在扩展程序文件夹中的文件。

I'm incredibly lost and new to browser extensions. I am making one related to dragons. Normally I would just use fs but this isn't an option since it's not node.

My browser extension folder has only three files: manifest.json, content-script.js, and dragons.json. I am making the extension in content-script.js and it's going swimmingly, but now I would like to read from and write to dragons.json. My extension will not be published or used for any other users, only me. How can I access this file? I am not trying to read the USER'S files, nor any external online files, just the files that are stored in the extension's folder.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文