Help us understand the problem. What is going on with this article?

Chrome localStorageへのアクセス

More than 5 years have passed since last update.

ChromeのlocalStorageを使う場合、そこにあるデータにアクセスするには二通りの方法がある。localStorageはwindowグローバルオブジェクトのプロパティ。

オブジェクトプロパティへのアクセスのような形

object_property.js
localStorage["one"] = 1;
var one = localStorage["one"];

アクセスメソッドを使う形

access_method.js
localStorage.setItem("one",1);
var one = localStorage.getItem("one");
```
Lewuathe
Java/Scala/Python/Hadoop/Presto
http://www.lewuathe.com
treasuredata
Customer Data Platformの開発・提供をしています。
https://www.treasuredata.co.jp/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away