LoginSignup
11
9

More than 5 years have passed since last update.

localStorageを利用した際にUncaught DOMExceptionが発生した場合の対処

Posted at

事象

local環境でのHTML,Javascriptの開発時に以下のようなエラーが発生し、localStorageが利用できない。

発生条件

ApacheなどのWEBサーバーは使わず、「file:///Users/〜省略〜/index.html」の様に、ローカルファイルをChromeで開いた場合

エラーログ

Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.

原因

「サードパーティのCookieをブロックする」をONになっていた。

対処法

  1. Chromeの設定画面にて「Cookie」で検索
  2. 「コンテンツ設定」を開く
  3. 「cookie」を開き、「サードパーティのCookieをブロックする」をOFFにする。

参考

Failed to read the 'localStorage' property from 'Window': Access is denied for this document · Issue #106 · apollographql/apollo-client-devtools · GitHub

11
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
9