html5離線應用和緩衝

來源:互聯網
上載者:User

標籤:blog   log   demo   ...   version   style   ons   網站   關閉   

1 localstorage和sessionstorage

 

sessionStrage:session即會話的意思,在這裡的session是指使用者瀏覽某個網站時,從進入網站到關閉網站這個時間段,session對象的有效期間就只有這麼長。localStorage:將資料儲存在用戶端硬體裝置上,不管它是什麼,意思就是下次開啟電腦時候資料還在。兩者區別就是一個作為臨時儲存,一個擁有長期儲存。
2本機資料庫
使用SQLLite資料庫,需要兩個必要步驟:建立資料庫訪問對象使用交易處理建立對象:openDatabase(dbName, version, dbDesc, size)實際訪問:db.transaction(function () {  tx.excuteSql(‘create table ......‘);});資料查詢:excuteSql(sql, [], dataHandler, errorHandler)//後面兩個為回呼函數;[]估計是做sql注入處理

3 manifest檔案

 

 

1 建議名稱尾碼名為.appcache

 

<!DOCTYPE HTML><html manifest="demo.appcache"><body>The content of the document......</body></html>

  

  

2 WEB-INF/web.xml 檔案裡設定.  <mime-mapping>    <extension>appcache</extension>    <mime-type>text/cache-manifest</mime-type>  </mime-mapping> 

 
3 demo.appcache如下
CACHE MANIFEST #我是注釋,這個檔案名稱叫test.manifest 
CACHE:
/當前項目名/test.css
/當前項目名/da.jpg
4 遊覽器第一次訪問會自動列印緩衝日誌

 

 



 
  

html5離線應用和緩衝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.