0
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 1 year has passed since last update.

session・LocalStorage・Cookie etc.違い

Posted at

はじめに

session・LocalStorage・Cookie etc… 違いをまとめた表は、多くのサイトで公開されているので、そちらをチェックした方が早いです。

理解したこと

・Cookieはユーザー情報。
キャッシュは、ページの情報。

・サーバーキャッシュは、過去に作成したファイルが、Webサイトがアップロードされているサーバーに、一時的に保存される仕組みを指す。

・sessionがどのクライアントの情報かは、Cookieに登録したsessionIDで確認できる。

・LocalStorageは、JSで操作できてしまう。
Cookieは、HttpOnly属性を記述すれば、JSから操作できない。
そのため、ローカルストレージでは、「秘密情報を一切含まないこと」「一般に入手可能な情報であること」「stringのみの情報であること」などの条件下で使うといい。

・settionStorageは、タブを閉じることで、情報が消える。(リロードや画面遷移は残る。)

・Cookie、キャッシュ、settionStorage、LocalStorageは、ブラウザ側で保管している。

考えたこと

違いが曖昧だった時は、同じように見えていたものが全然違った。
特にCookieとLocalStorageの違いは明白であった。

0
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
0
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?