Web Storage

Web Storage

仕様書

用法

[58] Storage は次の2種類が存在します。

[59] 歴史的には globalStorage もありました (>>6)。
[57] Widgets 1.0preferencesStorage でした (>>70)。

StorageEvent

[7] StorageEvent の非互換性メモ - Yet Another Hackadelic ( 版) http://d.hatena.ne.jp/ZIGOROu/20080924/1222246406

IE8 だと

event.uri; // #session
で取得出来るのに対して、Fx3 だと、
event.domain; // #session
で取れるみたい。ただ HTML5 の spec 的には event.url が正解のようです。

実装

[9] DOM Storage - MDC ( 版) https://developer.mozilla.org/en/DOM/Storage

[10] Bug 422526 – implement localStorage ( 版) https://bugzilla.mozilla.org/show_bug.cgi?id=422526

[3] Ex DOM Storage をリリースしました - Yet Another Hackadelic ( 版) http://d.hatena.ne.jp/ZIGOROu/20080924/1222221363

[8] Inside Ex DOM Storage - Yet Another Hackadelic ( 版) http://d.hatena.ne.jp/ZIGOROu/20080924/1222224102

[15] localStorageとsessionStorage - Thousand Years ( 版) http://d.hatena.ne.jp/shogo4405/20080908/1220806684

ローカル環境ではできないので、サーバ経由(ローカルホスト可能)で検証お願いします。でないと、localStorage/sessionStorageともにundefinedになります。

IE8 β2

IEβ1だと、localStorage/sessionStorageは実装されていなく、Firefoxと同じglobalStorage/sessionStorageが実装されているのでIE8β1で出来ない><という場合はβ2を試して下さい。(出典は、マイクロソフトの公開していたPDFですけど、URL紛失のために参考程度まで)

歴史

globalStorage

[6] Significant changes to globalStorage (Ian Hickson <ian@...> 著, 2007-12-11 01:46:50 +09:00 版) http://permalink.gmane.org/gmane.org.w3c.whatwg.discuss/12433

[14] globalStorage と localhost メモ - サバニFRP ( 版) http://d.hatena.ne.jp/fls/20061106/p1

If the script's domain contains no dots (U+002E) then the string ".localdomain" must be appended to the script's domain.

file:///path/… とした場合は確かに使えないっぽいのですが、file scheme で使えないというわけではなくて、 file:///path/… というのは本当は file://localhost/path/… のホスト部分を省略したもので、後者の省略しない URL でローカルのファイルを開けば storage が使えます。(http と同様に、localhost.localdomain と指定する。)

[13] Firefox 3 のglobalStorageの容量は3MBちょい? - 電脳戦士ハラキリ -SE道とは死ぬ事と見つけたり- ( 版) http://d.hatena.ne.jp/hagino_3000/20081026/1224961672

Firefox 3 のglobalStorageの容量は3MBちょい?

[16] Young risk taker.: [javascript] IEとFirefox2.0以上で動作するClient Side Storage ( 版) http://rakuto.blogspot.com/2006/11/javascript-iefirefox20client-side.html

Widget

[70] Widget 仕様は preferences IDL属性Storage継承した WidgetStorage オブジェクトを返すとしていました。

[71] WidgetStorageAPI としては違いがありませんが、 読み取り専用の項目が存在できます >>60

[72] しかし Widget が広く普及することはありませんでした。

関連

[11] document.cookie

[12] userData bahavior

[85] WebDAV とは無関係です。

メモ

[5] John Resig - DOM Storage Answers ( 版) http://ejohn.org/blog/dom-storage-answers/

[2] ローカルへのデータの保存を可能にするDOM Storage - builder by ZDNet Japan ( 版) http://builder.japan.zdnet.com/sp/firefox-3-for-developer-2008/story/0,3800087566,20384619,00.htm

[17] IRC logs: freenode / #whatwg / 20090302 ( 版) http://krijnhoetmer.nl/irc-logs/whatwg/20090302#l-172

  • [11:03] <virtuelv> Hixie: would you support splitting the storage spec from HTML5?
  • [11:04] <virtuelv> we have some use for the same interfaces in Widgets APIs and Events, and have some extra requirements, such as read-only storage, and the ability to reset storage to default values
  • [11:12] <Hixie> yeah it'll be taken out, uh, *consults calendar*
  • [11:13] * Hixie adds to the calendar
  • [11:13] <Hixie> this month!
  • [11:15] <virtuelv> Hixie: when you do, will you account for the extra requirements raised? (read-only storage items, reset to default (in Widgets, you can declare prefs in the manifest), and also making sure that it's agnostic towards where something is stored)?
  • [11:16] <Hixie> i would recommend inheriting from the Storage interface and defining those extensions in the widgets spec
  • [11:17] <jgraham> Hixie: Does that work better than making storage deal with both sets of requirements and making HTML5 say "all values are Read Write, All values default to undefined"
  • [11:18] <Hixie> jgraham: i'll have to look closer at the two needs to know which is better
  • [11:33] <Lachy> Hixie, are you splitting out localStorage/sessionStorage and the Database storage APIs together?
  • [11:33] <Hixie> yes
  • [11:34] <Lachy> ok, so basically the whole of section 5.11 "Structured client-side storage" will be removed
  • [11:34] <Hixie> Lachy: right
  • [11:38] <Hixie> Lachy: i'm tempted to leave them in the whatwg version (they'll still be in the whatwg source file...)

[18] Web Storage ( 版) http://dev.w3.org/cvsweb/~checkout~/html5/webstorage/Overview.html?content-type=text/html;%20charset=utf-8

[19] Client Side Databaseについて - 枕を欹てて聴く ( 版) http://d.hatena.ne.jp/Constellation/20090208/1234114965

[20] Web Storage ( 版) http://www.w3.org/TR/2009/WD-webstorage-20090423/

[21] FirefoxがlocalStorageに対応した - 素人がプログラミングを勉強するブログ ( 版) http://d.hatena.ne.jp/javascripter/20090424/1240562692

[22] IE8: Web Storage — Anne’s Weblog ( 版) http://annevankesteren.nl/2009/04/ie8-webstorage

[23] RE: DOM Storage feedback (Sunava Dutta 著, 版) http://lists.w3.org/Archives/Public/public-html-comments/2008Jun/0020.html

[24] Web Storage Elsewhere — Anne’s Weblog ( 版) http://annevankesteren.nl/2009/04/webstorage-bugs

[25] (X)HTML5 Tracking ( 版) http://html5.org/tools/web-apps-tracker?from=3548&to=3549

[26] IRC logs: freenode / #whatwg / 20090707 ( 版) http://krijnhoetmer.nl/irc-logs/whatwg/20090707#l-409

[27] Web Storage ( 版) http://www.w3.org/TR/2009/WD-webstorage-20090910/

[28] (X)HTML5 Tracking ( 版) http://html5.org/tools/web-apps-tracker?from=3877&to=3878

[29] CfC: to publish a new Working Draft of Web Storage spec; deadline 7 September (Arthur Barstow 著, 版) http://lists.w3.org/Archives/Public/public-webapps/2009JulSep/0888.html

[30] IRC logs: freenode / #whatwg / 20090807 ( 版) http://krijnhoetmer.nl/irc-logs/whatwg/20090807

[31] RE: DOM Storage feedback (Ian Hickson 著, 版) http://lists.w3.org/Archives/Public/public-html/2008Jun/0249.html

[32] IRC logs: freenode / #whatwg / 20090908 ( 版) http://krijnhoetmer.nl/irc-logs/whatwg/20090908

[33] IE Team's Feedback on HTML 5.0 DOM Store (Sunava Dutta 著, 版) http://lists.w3.org/Archives/Public/public-html-comments/2008Mar/0015.html

[34] [whatwg] localStorage + worker processes ( 版) http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-March/018991.html

[35] Web Storage ( 版) http://www.w3.org/TR/2009/WD-webstorage-20091029/

[36] IRC logs: freenode / #whatwg / 20090918 ( 版) http://krijnhoetmer.nl/irc-logs/whatwg/20090918#l-24

[37] Web Storage ( 版) http://www.w3.org/TR/2009/WD-webstorage-20091222/

[38] IRC logs: freenode / #whatwg / 20100430 ( 版) http://krijnhoetmer.nl/irc-logs/whatwg/20100430#l-457

[39] [whatwg] Proposal for secure key-value data stores ( ( 版)) http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010-August/027968.html

[40] [whatwg] Proposal for secure key-value data stores ( 版) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2010-November/029254.html

[41] Web Applications 1.0 r5806 Drop the syntax sugar for walking the keys of a Storage object. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=5805&to=5806

[42] Web Storage ( ( 版)) http://www.w3.org/TR/2011/WD-webstorage-20110208/

[43] [whatwg] localStorage feedback ( ( 版)) http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-December/024277.html

[44] [whatwg] localStorage, the storage mutex, document.domain, and workers ( ( 版)) http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-September/023059.html

[45] IRC logs: freenode / #whatwg / 20110603 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20110603

[46] Web Applications 1.0 r6364 Remove the structed data support from Web Storage. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=6363&to=6364

[47] Web Applications 1.0 r6368 Allow UAs to opt out of the storage mutex and corrupt data instead of being slow. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=6367&to=6368

[48] Web Storage ( ( 版)) http://www.w3.org/TR/2011/WD-webstorage-20110901/

[49] Web Storage ( ( 版)) http://www.w3.org/TR/2011/WD-webstorage-20111025/

[50] Web Storage ( ( 版)) http://www.w3.org/TR/2011/CR-webstorage-20111208/

[51] IRC logs: freenode / #whatwg / 20120204 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20120204

[52] ローカルストレージに簡単な解決策はない « Mozilla Developer Street (modest) ( ( 版)) https://dev.mozilla.jp/hacksmozillaorg/there-is-no-simple-solution-for-local-storage/

[53] Web Applications 1.0 r7722 Try to define order for supported property names. This is not based on testing. If there are compatibility constraints here that prevent implementing this as specced, please let me know. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=7721&to=7722

[54] Web Storage ( ( 版)) http://www.w3.org/TR/2013/PR-webstorage-20130409/

[55] Web Storage ( ( 版)) http://www.w3.org/TR/2013/REC-webstorage-20130730/

[56] IE10 で JavaScript から localStorage を使おうとすると「アクセスが拒否されました( Access is denied )」エラーで実行時エラーになる問題 - oogattaの勉強日記 ( ( 版)) http://d.hatena.ne.jp/oogatta/20130915/1379254189

[61] HTML5, WebStorage, WebSQL memo - latest log ( ( 版)) http://uupaa.hatenablog.com/entry/2013/02/04/082411

[62] Bug 27378 – Apparently DNT started using "effective script origin" for no reason. Perhaps we can rename it "legacy origin" to make sure people do not use it for new things? ( ( 版)) https://www.w3.org/Bugs/Public/show_bug.cgi?id=27378#c21

[1] w3c/webstorage-2nd-edition ( 版) https://github.com/w3c/webstorage-2nd-edition

[63] A Second Edition of Web Storage? [was: Re: Web Storage Rec errata?] (Xiaoqian Wu 著, 版) https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0607.html

[64] Re: CfC: Moving webstorage to REC 2nd Edition; deadline May 21 (Xiaoqian Wu 著, 版) https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0781.html

[65] Web Storage (Second Edition) ( ( 版)) http://www.w3.org/TR/2015/CR-webstorage-20150609/

[73] PSA: Change the Latest Editor's Drafts of WebStorage, WebWorkers, WebMessaging, Server-Sent Events and WebSockets (Xiaoqian Wu 著, 版) https://lists.w3.org/Archives/Public/public-webapps/2015OctDec/0099.html

[74] Safari 4.0 ( 版) https://developer.apple.com/library/safari/releasenotes/General/WhatsNewInSafari/Articles/Safari_4_0.html#//apple_ref/doc/uid/TP40014305-CH4-SW17

WebKit now supports the new HTML5 Storage interface, which provides two local key-value stores: a per-window store named sessionStorage and a per-host store named localStorage.

[75] Web Storage (Second Edition) ( ( 版)) http://www.w3.org/TR/2015/PR-webstorage-20151126/

[76] Remove the storage mutex · Issue #335 · whatwg/html ( 版) https://github.com/whatwg/html/issues/335

[77] Define how localStorage is synchronized between browser tabs/windows · Issue #403 · whatwg/html ( 版) https://github.com/whatwg/html/issues/403

[78] Remove the storage mutex due to lack of implementation · whatwg/html@1b918cf ( 版) https://github.com/whatwg/html/commit/1b918cf72fcbba011f83b92ab5d1f483fb1cafa3

[79] Web Storage (Second Edition) ( 版) https://w3c.github.io/webstorage/

The latest edits to Web Storage are maintained in https://html.spec.whatwg.org/multipage/webstorage.html.

[80] Editorial: define Event attribute defaults through IDL · whatwg/html@0be0229 ( 版) https://github.com/whatwg/html/commit/0be02299f128cbb7c65a7ce259fdd838fd44a4b5

[81] Merge effective script origin into origin · whatwg/html@8a843f2 ( 版) https://github.com/whatwg/html/commit/8a843f2169a6864a3024c4329528dccb2051d275

[82] Web Storage (Second Edition) ( 版) https://www.w3.org/TR/2016/REC-webstorage-20160419/

[83] ios - (How) Can a web site determine if Safari Private Browsing is turned on? - Ask Different () http://apple.stackexchange.com/questions/131587/how-can-a-web-site-determine-if-safari-private-browsing-is-turned-on

On iOS, HTML5's local storage is not available in private browsing mode

[84] ARIB TR-B39 () http://www.arib.or.jp/english/html/overview/doc/4-TR-B39v1_0-1p4.pdf#page=252

setItem(key,value)

10.1.1.2 に示す視聴者居住情報の「県域コード」、「緊急警報信号に対応

した地域符号」を示すキーは指定しないこと。指定した場合の動作は

保証されない。

value には記録する文字列を指定することが出来る。10.1.3 に規定する

記憶容量を超えた場合、QUOTA_EXCEEDED_ERR が発生し、メソ

ッドの動作は行われない。

removeItem(key)

10.1.1.2 に示す Greg, Ureg, 放送事業者共通領域、視聴者居住情報を

示すキーは指定しないこと。指定した場合の動作は保証されない。

<共通事項>

 "_"で始まるキー名は、不揮発性記憶領域のうち放送領域にアクセスするために用いる。将来、

放送領域が拡張される可能性に鑑み、10.1.1.2 にて規定されるキー名以外の"_"で始まるキー

名は、将来の放送領域拡張用の予約語とし、使用しないこと。

 一般領域以外のアイテム(不揮発性記憶領域のうち放送領域、および、一時記憶領域)への

アクセスは、メソッドを用いる方法(localStorage.getItem()、localStorage.setItem())によ

ってのみ行う。すなわち、アイテムを localStorage オブジェクトのプロパティ

(localStorage.key)として参照・代入する方法、連想配列(localStorage[key])として参照・

代入する方法は用いない。

[86] 93390 – Allow blocking of third-party localStorage and sessionStorage ( ()) https://bugs.webkit.org/show_bug.cgi?id=93390

[87] 115004 – Change approach to third-party blocking for LocalStorage ( ()) https://bugs.webkit.org/show_bug.cgi?id=115004

[88] webkit ではサードパーティドメインの localStorage が sessionStorage になる - Please Sleep ( ()) http://please-sleep.cou929.nu/webkit-storage-blocking-policy.html

[89] サードパーティオリジンの LocalStorage の挙動を調べてみた - kitak.blog ( ()) http://kitak.hatenablog.jp/entry/2014/11/07/101022

[90] Add domintro blocks for “Web storage” interfaces (sideshowbarker著, ) https://github.com/whatwg/html/commit/a39012210e708fcc3a7109284301e7f040c6fd32

[91] Add domintro blocks for “Web storage” interfaces by sideshowbarker · Pull Request #3179 · whatwg/html () https://github.com/whatwg/html/pull/3179

[92] Add initStorageEvent() (foolip著, ) https://github.com/whatwg/html/commit/18ca10633ffbcbe2a95dd1d42dfb04c798cc5700

[93] Add initStorageEvent() by foolip · Pull Request #4063 · whatwg/html () https://github.com/whatwg/html/pull/4063