パッケージ化されたアプリにローカル データベースを実装しようとしましたが、動作していないようです。
IndexedDB のレイヤーであるPouchDBを使用してみました。次に、ネイティブの IndexedDB API を使用してみました。どちらも機能せず、同じメッセージが表示されます。An attempt was made to break through the security policy of the user agent.
パッケージ化されたアプリのデータベース メソッドについて Google で検索しましたが、FileSystem APIの使用方法に関する情報しか見つかりませんでした。
Chrome でパッケージ化されたアプリでのデータベースの実装を指すリンクは非常に役立ちます (または、私が何か間違ったことをしている場合はお知らせください)。
IndexedDB を開始するサンプル コード:
idbSupported = false;
db = '';
if("indexedDB" in window) {
idbSupported = true;
}
if(idbSupported) {
var openRequest = indexedDB.open("test",1);
openRequest.onupgradeneeded = function(e) {
console.log("Upgrading...");
}
openRequest.onsuccess = function(e) {
console.log("Success!");
db = e.target.result;
}
openRequest.onerror = function(e) {
console.log("Error");
console.dir(e);
}
}
マニフェスト ファイル内のアクセス許可
"permissions": ["http://*/*", "https://*/*","storage","fileSystem"]