1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

JavaScript クッキーの読み・書き・削除(承認パネル)

Last updated at Posted at 2021-03-02

クッキーの読み、書き、削除について学んだ。備忘録を残す。

クッキーとは

  • ブラウザ間でやりとりされる小さなデータ。ヴラウザとユーザー間でやりとりされ、主にログイン情報などを管理する。ECサイトやSNSなどで広く使用される。

OSライブラリ「js-cookie」

  • クッキーのデータを操作するのに利用するOpenSourceライブラリ。クッキー操作をするための補助プログラム。
    HTMLファイルに読み込ませることでクッキーデータの操作ができるようになる。

jsライブラリのメソッド

クッキー保存のメソッド

Cookies.set('変数名','値',{expire: 有効期間});

  • 上記のメソッドを使用すると、指定した変数に有効期間、値が保存される。
1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?