gpt4 book ai didi

javascript - 为什么我无法在 Chrome 应用中选择文件?

转载 作者:行者123 更新时间:2023-11-28 10:46:02 25 4
gpt4 key购买 nike

我正在尝试从 Chrome 应用中选择 .txt 文件,但它不允许我这样做。一切都变灰了!我的manifest.json的一部分:

"permissions": [
"serial",
"notifications",
{"fileSystem": ["write", "retainEntries", "directory"]}
],
"file_handlers": {
"text": {
"types": [
"text/*"
]
}

我的 JS 文件的一部分:

chrome.fileSystem.chooseEntry({type: "openDirectory"},     function() {
console.log();
});

chrome.fileSystem.getWritableEntry(chosenFileEntry, function(writableFileEntry) {
writableFileEntry.createWriter(function(writer) {
writer.onerror = errorHandler;
writer.onwriteend = callback;

chosenFileEntry.file(function(file) {
writer.write(file);
});
}, errorHandler);
});

最佳答案

@Adam Mazzarella 是对的。新发布的 Chrome 应用仅适用于 Chrome 操作系统的用户。现有的 Chrome 应用程序将在所有平台上保持可访问性,开发人员可以继续更新它们。强烈鼓励开发人员migrate your Chrome apps到网络。

从此documentation :

Chrome packaged and hosted apps will be discontinued on Windows, Mac, and Linux over the course of now and early 2018. For more information, refer to the August 2016 Chromium blog post. This transition does not apply to Chrome OS, where Chrome packaged and hosted apps will remain supported and maintained for the foreseeable future.

To transition away from a Chrome packaged or hosted app on Windows, Mac, and Linux, the following options are available.

  • Build a web app
  • Build an extension-enhanced web page
  • Build an extension
  • Build a native app

希望这有帮助!

关于javascript - 为什么我无法在 Chrome 应用中选择文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42987690/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com