Google chrome extension Chrome扩展请求本地存储QuoteExceedeError
我正在开发一个可以用作备忘录的chrome扩展 我搜索了互联网,发现chrome.storage API在我的情况下可能很有用 但是,当我在本地请求存储时,总是遇到“QuoteExceedeError” 以下是我的javascript代码:Google chrome extension Chrome扩展请求本地存储QuoteExceedeError,google-chrome-extension,google-chrome-app,Google Chrome Extension,Google Chrome App,我正在开发一个可以用作备忘录的chrome扩展 我搜索了互联网,发现chrome.storage API在我的情况下可能很有用 但是,当我在本地请求存储时,总是遇到“QuoteExceedeError” 以下是我的javascript代码: window.onload = function() { openLocalFileSystem(true); } function openLocalFileSystem(isReadMode) { navigator.webkitPers
window.onload = function() {
openLocalFileSystem(true);
}
function openLocalFileSystem(isReadMode) {
navigator.webkitPersistentStorage.requestQuota(1024 * 1024 * 10, function(grantBytes) {
window.webkitRequestFileSystem(window.PERSISTENT, grantBytes,
function(fs) {
console.log(grantBytes); // ALWAYS 0! WHY???
onFileSystemOpened(fs, isReadMode);
},
function(e) {
console.log("Couldn't request file system!");
});
});
}
有人能帮我吗?非常感谢 特定于Chrome应用程序,与其他应用程序分开
为了从Chrome应用程序中使用
requestQuota
,您应该在manifest.json
文件中添加权限。我在json文件中请求了权限:“权限”:[“syncFileSystem”,“unlimitedStorage”]。但是仍然不起作用我使用了无限制存储和storage/localStorage很好,但可能它不适用于文件系统存储?