html5使用local storage儲存的資料在本地是以何種形式儲存的

來源:互聯網
上載者:User

html5使用local storage儲存的資料是如何儲存在本地的?(我使用的是chrome瀏覽器,chrom瀏覽器是用sqlite來儲存本機資料的)

Html5 的local storage 是通過瀏覽器在本機存放區的資料。

基本使用方法如下:

<script type="text/javascript">localStorage.firstName = "Tom";alert(localStorage.firstName);</script>

這樣的話,就將資料儲存到本地了,但是本機資料是以什麼形式進行儲存的呢,經過跟蹤,發現在Chrome瀏覽器中,資料是以sqlite的資料庫檔案形式儲存的。

在windows下,是儲存在C:\Documents and Settings\User Name\Local Settings\Application Data\Google\Chrome\User Data\Default\Local Storage 路徑(其中User Name是指當前的使用者名稱)下的;

在Mac下,是儲存在/Users/User Name/Library/Application Support/Google/Chrome/Default/Local Storage路徑(其中User Name是指當前的使用者名稱)路徑下的

雖然尾碼名是.localstorege 但是實際上就是sqlite的資料庫檔案,可以用sqlite開啟,並看到其中的資料。(可以使用firefox的SQLite Manager附加組件開啟)

安裝組件步驟和安裝firebug類似,選擇菜單工具-->附件組件,開啟附件組件設定頁,搜尋"SQLite Manager"關鍵字,安裝"SQLite Manager"外掛程式後重啟firefox,就可以在工具中看到"SQLite Manager"附加組件了,如所示:

是查看剛剛儲存的本機資料檔案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.