コンテンツにスキップ

ウェブストレージ

出典: フリー百科事典『ウィキペディア(Wikipedia)』

(Web storage)DOM (Document Object Model storage) HTTP cookie[1]HTTP request header[2](local storage)(session storage)2persistent cookiesession cookieWorld Wide Web Consortium (W3C)[3]WHATWG[4]

[]






HTTP 



4 KB
Mozilla Firefox5 MB[5]

Google Chrome10 MB [6]

Internet Explorer 10 MB [7]



2    RFC 62658.58.6 [8]



 APIW3C Web[9]

使[]


window sessionStorage  localStorage JavaScript
// セッション期限に限ってブラウザに値を保存する
sessionStorage.setItem('key', 'value');

// 値を得る (ブラウザを閉じて再度開くと消去される)
alert(sessionStorage.getItem('key'));

// セッション期間を超えてブラウザに値を保存する
localStorage.setItem('key', 'value');

// 値を得る (ブラウザを閉じて再度開いても継続する)
alert(localStorage.getItem('key'));

API[10]JSONJavaScript
// 文字列のかわりにオブジェクトを保存する
localStorage.setItem('key', {name: 'value'});
alert(typeof localStorage.getItem('key')); // string

// 文字列のかわりに整数を保存する
localStorage.setItem('key', 1);
alert(typeof localStorage.getItem('key')); // string

// JSONを使ってオブジェクトを保存する
localStorage.setItem('key', JSON.stringify({name: 'value'}));
alert(JSON.parse(localStorage.getItem('key')).name); // value

名称[編集]


W3CWeb StorageDOM storage使使MozillaMicrosoftDOM StorageWeb Storage[11][12][13][14]

DOMDOMDocument Object Model W3CDOM使API使Document[15]

[]


[16]

Firefox webappsstore.sqlite SQLite webappsstore.sqlite [17]

Google ChromeSQLiteWindows \AppData\Local\Google\Chrome\User Data\Default\Local Storage macOS ~/Library/Application Support/Google/Chrome/Default/Local Storage [18]

OperaOpera \AppData\Roaming\Opera\Opera\sessions\autosave.win  \AppData\Local\Opera\Opera\pstorage\ [19]

Internet Explorer \AppData\LocalLow\Microsoft\Internet Explorer\DOMStorage 

[]


Indexed Database API

[]



(一)^ Opera Web Storage, 2011 http://dev.opera.com/articles/view/web-storage/

(二)^ AndyHume.net, 2011 http://blog.andyhume.net/localstorage-is-not-cookies

(三)^ Web Storage. W3.org. Retrieved on 2011-06-12.

(四)^ HTML Living Standard 11 Web storage

(五)^ John Resig: DOM Storage. John Resig, ejohn.org. Retrieved on 2011-06-12.

(六)^ Issue 21680002: Up the window.localstorage limit to 10M from 5M. - Code Review. chromiumcodereview.appspot.com. 2020113

(七)^ Introduction to Web Storage. Microsoft Developer Network, msdn.microsoft.com. Retrieved on 2014-08-05.

(八)^ W3C: HTML Living Standard. (2020-01-09). Retrieved on 2020-01-13.

(九)^ W3C: Indexed Database API. W3C. Retrieved on 2012-02-12.

(十)^ W3C, 2011 http://dev.w3.org/html5/webstorage/

(11)^ DOM Storage. Mozilla Developer Network. 2011642011612

(12)^ Web Storage API. Mozilla Developer Network. 2017628

(13)^ Introduction to DOM Storage. Microsoft Developer Network. 2011682011612

(14)^ Introduction to Web Storage. Microsoft Developer Network. 2017628

(15)^ W3C: Web Storage draft standard. Dev.w3.org (2004-02-05). Retrieved on 2011-06-12.

(16)^ How to enable, disable, or clear your browser's "Web Storage" cache - MIDAS Knowledgebase. mid.as. 2020113

(17)^ html5 - Where does Firefox store javascript/HTML localStorage?. Stack Overflow. 2020113

(18)^ html - How is HTML5 WebStorage data physically stored?. Stack Overflow. 2019716

(19)^ local storage - Where the sessionStorage and localStorage stored?. Stack Overflow. 2020113

外部リンク[編集]