Web StorageãšHTML5 Application Cacheã«é¢ãã玹ä»èšäºããã§ã«å ¬éããŠããŸãã åºæ¬çãªæŠå¿µã«ç²ŸéããŠããªãå Žåã¯ãããããèªãããšããå§ãããŸãã ãã®èšäºã§ã¯ãWebSQLãå«ããããã®ãã¯ãããžãŒãæ¹èšãããããã®å ±åå¹æçãªäœ¿çšã®ããã®ãªãã·ã§ã³ã«ã€ããŠèª¬æããŸãã ããããã¹ãŠã®ãã¯ãããžãŒã¯ããã¹ã¯ãããããŒãžã§ã³ã®ãã©ãŠã¶ãŒOpera 11.10ãOpera Mobile 11ãWebKitãšã³ãžã³ã«åºã¥ããã©ãŠã¶ãŒïŒiOSããã³Google AndroidïŒã§ãµããŒããããŠããŸãã
泚ïŒä»¥äžã§èª¬æãããã¹ãŠã®äŸã¯ã ãã®ã¢ãŒã«ã€ãã§å©çšã§ããŸã ã èšäºãèªãã§ããéïŒåœç¶ãªããããªãã©ã€ã³ã§ïŒã¢ãŒã«ã€ããããŠã³ããŒãããŠäŸãèŠãããšãã§ããŸãã |
ãªãããªãã©ã€ã³ã¢ãŒãããå¿ èŠãªã®ã§ããïŒ
WebããŒãžã¯åãªãããã¹ãã§ã¯ãããŸããã ã€ã³ã¿ãŒãããã¯ãŸããŸãæ®åããŠãããWebã¢ããªã±ãŒã·ã§ã³ãããããããè€éã§æŽç·ŽãããŠããŸãã ãããŠãããããžã®äŸå床ã¯é«ãŸã£ãŠããŸãã Webã¢ããªã±ãŒã·ã§ã³ãåŸæ¥ã®ãã¹ã¯ãããã¢ããªã±ãŒã·ã§ã³ã«ä»£ãã£ãŠæåããŠããäŸãå¢ããŠããŠããŸãããã®äž»ãªå©ç¹ã¯ãåžžã«ãªãã©ã€ã³ã§å¹³åã«äœæ¥ã§ããããšã§ãã Webã¢ããªã±ãŒã·ã§ã³ã«åãæ©äŒãäžããããšã¯ãå¿ èŠãªæè¡ãšããŒã«ã®äžè¶³ãèš±ããŸããã§ããã
ããããä»ã§ã¯ããã¯åé¡ã§ã¯ãããŸããïŒ HTML5ã¢ããªã±ãŒã·ã§ã³ãã£ãã·ã¥ãWebã¹ãã¬ãŒãžãWebSQLãªã©ã®æè¡ã®åºçŸã«ãããWebã¢ããªã±ãŒã·ã§ã³ããªãã©ã€ã³ã§åäœãããæ¹æ³ãã€ãã«åŸãããŸããã
- ã¢ããªã±ãŒã·ã§ã³ãã£ãã·ã¥ã䜿çšãããšãWebã¢ããªã±ãŒã·ã§ã³ã®HTMLãCSSãããã³ãã®ä»ã®èŠçŽ ã®ã³ããŒããªãã©ã€ã³ã«ä¿ã€ããšãã§ããŸããããã¯ããããã¯ãŒã¯ãå©çšã§ããªããšãã«äœ¿çšãããŸãã
- Web Storageã¯ãCookieãªã©ã®ã¹ãã¬ãŒãžã¡ã«ããºã ã«åºã¥ããŠãããããæè»ã§åŒ·åãªå®è£ ãè¡šããŠããŸãã
- WebSQLã¯ããã©ãŠã¶å ã«æ¬æ ŒçãªSQLããŒã¿ããŒã¹ãå®è£ ããŸãããã®ããŒã¿ããŒã¹ã¯ããªãã©ã€ã³ã§äœ¿çšããããã«Webã¢ããªã±ãŒã·ã§ã³ããŒã¿ã®ã³ããŒãä¿åã§ãããŠãŒã¶ãŒããããã¯ãŒã¯æ¥ç¶ã倱ã£ãŠãããŒã¿ã®æäœãç¶è¡ã§ããŸãã ããŒã¿ã¯ã次ã«ãããã¯ãŒã¯ã«æ¥ç¶ãããšãã«ãµãŒããŒãšåæãããŸãã
ãããã¯ãŒã¯æ¥ç¶ã倱ãããçç±ã¯æ°å€ããããŸããåé»ããããã¯ãŒã¯æ©åšã®åé¡ãæºåž¯é»è©±äœ¿çšæã®ä¿¡å·ã®æ¬ èœïŒãŸãã¯åŒ±ãïŒã§ãã éçºè ãšããŠããã®ãããªç¶æ³ã§ããWebã¢ããªã±ãŒã·ã§ã³ãïŒå°ãªããšãåççãªå¶éå ã§ïŒæ£ããåäœããããšã確èªããããšèããŠããŸãã
ãã£ãã·ã¥ïŒããŒããããããã¯ãŒã¯ããªãå Žå
äžè¬ã«ããªã³ã©ã€ã³ã§ãªãå Žåããµã€ãã®ããŒãžãããŒããŸãã¯ãªããŒããããšãã«ãšã©ãŒãçºçããŸãã æåã«è¡ãããšã¯ããŠãŒã¶ãŒãæ¥ç¶ãªãã§ãããŒãžã衚瀺ããŠWebã¢ããªã±ãŒã·ã§ã³ãæäœã§ããããã«ããããšã§ãã ãã®ã¢ãŒãã§ã¯ããã¹ãŠã®ç»åãCSSãJavaScriptãããã³HTMLããŒãžèªäœãæ£ããèªã¿èŸŒãŸããŸãã
ããã¯ãã¢ããªã±ãŒã·ã§ã³ãã£ãã·ã¥ãã¯ãããžãŒïŒAppCacheãšãåŒã°ããŸãïŒã䜿çšããŠå®çŸãããŸãã ããã䜿çšããã«ã¯ããŸãã¢ããªã±ãŒã·ã§ã³ããªãã©ã€ã³ã§äœæ¥ããå¿ èŠããããã¡ã€ã«ã®ååã瀺ããããã§ã¹ããã¡ã€ã«ã宣èšããå¿ èŠããããŸãã
demo.manifestãã¡ã€ã«ã®äŸïŒ
CACHE MANIFEST CACHE: logo.png style.css script.js jquery.js index.htm
ãã®ãããã§ã¹ããã¡ã€ã«ã«å«ãŸãããªã³ã¯ãäœã§ããã察å¿ããã³ã³ãã³ãã¯ãã£ãã·ã¥ããããã®åŸããã®ã³ã³ãã³ããžã®ã¢ã¯ã»ã¹ã¯æ¢ã«å©çšå¯èœã«ãªããŸãã ãããã§ã¹ããã¡ã€ã«ã®å®£èšã¯éåžžã«ç°¡åã§ã- <html>èŠçŽ ã®manifestå±æ§ã䜿çšããå¿ èŠããããŸãã
<html manifest="demo.manifest">
ãã®ãã¡ã€ã«ã§å®£èšããããã¹ãŠã®ãã¡ã€ã«ã¯ãã©ãŠã¶ã«ãã£ãã·ã¥ãããŸãã ãŠãŒã¶ãŒããªãã©ã€ã³ã§ããŒãžãããŒãããããšããŠãããã®ãã¡ã€ã«ã«ç€ºãããŠãããã¹ãŠã®ãªãœãŒã¹ã¯ãã©ãŠã¶ãŒã«ãã£ãŠããŠã³ããŒããããŸãã
HTML5 Application Cacheã«é¢ããèšäºã§ããã詳现ãªæ å ±ãèŠã€ããããšãã§ããŸãã
ããŒã¿ã¯ã©ãã§ããïŒ
AppCacheã¯ããµã€ãã®äžéšã®èŠçŽ ã®ãªãã©ã€ã³ã§ã®ã¢ã¯ã»ã·ããªãã£ã®åé¡ã解決ããŸãããããçšåºŠã®ãŠãŒã¶ãŒããŒã¿ããããšãã°ææ°ã®æ€çŽ¢ãä¿åãããå ŽåããããŸãã å¥ã®ã±ãŒã¹ã§ã¯ãããæ§é åãããããŒã¿ãä¿åãããå ŽåããããŸãã ãããã«ããŠããWeb StorageãšWebSQLãæé©ãªãœãªã¥ãŒã·ã§ã³ã«ãªããŸãã
Web Storageã䜿çšãã
Web Storageã¯ã巚倧ãªããŒã¿ããŒãã«ãããå°éã®æ å ±ãä¿åããã®ã«æé©ã§ããããã«ã€ããŠã¯ããã®èšäºã§ç°¡åã«èª¬æããäŸãæ€èšããŸãã 詳现ã«ã€ããŠã¯ã Web Storageã«é¢ããå¥ã®èšäºãåç §ããŠãã ããã
é »ç¹ãªåé»ãé »ç¹ã«çºçããå Žæã¯ãããããããŸãïŒç¿»èš³è ããã® "ChubaisãhelloïŒ:)"ïŒã ãŠãŒã¶ãŒã¯ãé»æºãå ¥ãããŸã§ã€ã³ã¿ãŒãããã§äœæ¥ãç¶ããããšãã§ãããŸã§åº§ã£ãŠåŸ ã€å¿ èŠããããŸãã ãããŠã誰ãã䌌ããããªç¶æ³ã«ãããã©ã®ãµã€ãã§ãè€æ°ããŒãžã®ãã©ãŒã ã«èšå ¥ããããã°ãéèŠãªã¡ãŒã«ã®å€§ããªèšäºãå ¥åããŠãããšæ³åããŠãã ããã åé»äžïŒãŸãã¯ããããªãŒåãïŒã«ããŠãŒã¶ãŒã¯ãã®ããŒã¿ããã¹ãŠå€±ããŸãã ãããã¯ãŒã¯ã«å ¥ã£ãåŸã圌ãä¿åããŠããªããã¹ãŠã®ã¬ã³ãŒãã«ã¢ã¯ã»ã¹ããããã䜿çšããŠäœæ¥ãç¶ããããšãã§ããããããšæããŸãããïŒ
ãã¬ãŒã³ãª<textarea>ããã¹ããã£ãŒã«ããå«ãããŒãžã§äœãã§ãããèŠãŠã¿ãŸãããã ããŒãžã¯ãæ°ç§ããšã«ããŒã«ã«ã¹ãã¬ãŒãžã«å ¥åãããã¹ãŠãä¿åããå¿ èŠããããŸããããŒãžããªããŒããŸãã¯éãããšãããŒãžã¯ãã£ãŒã«ãã«ä¿åãããŠããæåŸã®ããã¹ããããŒãããå¿ èŠããããŸãã
ããŒãžã«id "draft"ã®<textarea>ãã£ãŒã«ããå«ãŸããŠãããšããŸãããïŒ
... <textarea id="draft" rows="10" cols="30"></textarea> ...
ããŒã«ã«ã¹ãã¬ãŒãžã«<textarea>ã®å 容ãä¿åããåçŽãªé¢æ°ãäœæããŸãã
function saveMessage(){ var message = document.getElementById("draft"); localStorage.setItem("message", message.value) }
ä¿åééã0.5ç§ã«èšå®ããŸãã
setInterval(saveMessage, 500);
泚ïŒããã§ã¯ãç°¡åã«ããããã«setIntervalïŒïŒã䜿çšããŠãã¡ãã»ãŒãžã0.5ç§ããšã«ããŒã«ã«ã¹ãã¬ãŒãžã«ä¿åããŸããã ïŒããšãã°ããŠãŒã¶ãŒãäœããå ¥åããå Žåã«ã®ã¿ããã¹ããã£ãŒã«ãã®å 容ãä¿åãããªã©ããã®æé ãæ¹åã§ããŸãïŒã |
ãŸããããŒãžãéãããªããŒããããã³ã«ãããŒã«ã«ã¹ãã¬ãŒãžïŒ localStorage ïŒããæåŸã«ä¿åãããã³ã³ãã³ããããã¹ãããã¯ã¹ã«ããŒããããããšã確èªããå¿ èŠããããŸãã
window.addEventListener("DOMContentLoaded", loadMessage, false); function loadMessage() { var textbox = document.getElementById("draft"); var message = localStorage.getItem("message"); if (!message) { textbox.value = ""; }else { textbox.value = message; } }
Web Storageã®äœ¿çšäŸãã芧ãã ããã ããã¯äžè¬çã«ã·ãã¯ã§ã
å®éã«ã¯ãããŒã«ã«ã«å°ããªæ å ±ãä¿åããå¿ èŠãããå Žåã§ãã
ãªãã©ã€ã³ã§äœæ¥ããŠããŸã
ãªãã©ã€ã³ã«ããã«ã¯ããããæå¹ã«ããå¿ èŠããããŸãïŒOperaãã©ãŠã¶ã§ïŒãã¡ãã¥ãŒãâãèšå®ãâããªãã©ã€ã³ã§äœæ¥ããŸãã¯ããã¡ã€ã«ãâããªãã©ã€ã³ã§äœæ¥ãïŒã ãã©ãŠã¶ãŒããªãã©ã€ã³ã®å Žåã navigator.onLineããããã£ã¯false ã§ã ããã以å€ã®å Žåã¯trueã§ãã ãã ããå€ãã®å Žåãã€ãã³ãã䜿çšããããšããå§ãããŸãã ãŠãŒã¶ãŒããªãã©ã€ã³ã¢ãŒãã«åãæ¿ãããšã ãªãã©ã€ã³ã€ãã³ããããªã¬ãŒãããŸã ã ããã䜿çšããŠããªãã©ã€ã³ã«ãªãããšã«é¢ããå°ããªã¡ãã»ãŒãžã衚瀺ã§ããŸãã
次ã®ãããªãã®ãåŸãããŸãã
... window.addEventListener( "offline", function(){showWarningDiv("on")}, false); window.addEventListener( "online", function(){showWarningDiv("off")}, false); ... function showWarningDiv(status){ var warningdiv = document.getElementById("warning"); if (status == "on"){ warningdiv.innerHTML = "<p style=\"padding:3px;\">Right now you are in offline mode. This message is saved and will be sent to the server the next time you are online.</p>"; } else { warningdiv.innerHTML = ""; } }
泚ïŒçŸåšããªãã©ã€ã³ãµããŒãã¯OperaãšFirefoxã§ã®ã¿å©çšå¯èœã§ãã |
ãŠãŒã¶ãŒããªãã©ã€ã³ã§äœæ¥ããŠãããšãã«ãã©ãŒã ãããŒã¿ãéä¿¡ããããšããŠããªãããšã確èªããããšã¯çã«ããªã£ãŠããŸãã ããã確èªããã«ã¯ã次ã®ããã«ããŸãã
... window.addEventListener( "submit", submitForm, false); ... function submitForm(){ saveMessage(); if (!navigator.onLine){ return false; } }
ãã©ãŒã ããŒã¿ãéä¿¡ãããšã submitFormïŒïŒé¢æ°ãåŒã³åºãéä¿¡ã€ãã³ããçºçããŸãã ãã®é¢æ°ã¯ãæåã«ã¡ãã»ãŒãžãããŒã«ã«ã¹ãã¬ãŒãžã«ä¿åãããŠãŒã¶ãŒããªãã©ã€ã³ã§äœæ¥ããŠããå ŽåãããŒã¿ã¯ã©ãã«ãéä¿¡ãããŸããã
ãã®äŸãæ¹è¯ããŠãæ°ç§ããšã«ãµãŒããŒã«ã³ããŒãä¿åãããŠãŒã¶ãŒãèªåãã誀ã£ãŠããŒã¿ãåé€ããå Žåã«äœ¿çšã§ããããã«ããããšãã§ããŸãã ããã¯ãä»äºã®å Žåãããšãã°æ©å¯æ å ±ãæ±ãå Žåã«ç¹ã«éèŠã§ããããšãã°ãã¯ã¬ãžããã«ãŒãæ å ±ãèªåã®å ŽæïŒããŒã«ã«ã¹ãã¬ãŒãžïŒã«ã®ã¿ä¿åããââãå Žåã
sessionStorageãæ å ±ãä¿åããããã«äœ¿çšããããé«åºŠãªäŸãåç §ããŠãã ããã ïŒãªããŒãããŠãïŒããŒãžãéããªãå Žåãããã¹ãããã¯ã¹ã«å ¥åããããã¹ãã¯ãã®ãŸãŸæ®ããŸãã ãŸããããŒãžã¯ãã®ãã£ãŒã«ãã®å 容ãæ°ç§ããšã«ãµãŒããŒã«éä¿¡ããããã«å¿ããŠãæåŸã®ä¿åã®æå»ãæŽæ°ããŸãã ãã®ã¢ãããŒãã¯ãããã°ãšã³ãžã³ãšã¡ãŒã«ãµãŒãã¹ã§ããã©ããããå®æçã«ä¿åããããã«äœ¿çšã§ããŸããããã«ãããæ¥ç¶ã®åé¡ãçºçããŠãäœæ¥ãç¶ããããšãã§ããŸãã
WebSQLïŒãŸã ãã¹ã¿ãããªãã©ã€ã³
Web Storageã¯å°éã®æ å ±ãä¿åããã®ã«æé©ã§ãããããŒã¿ããŒã¹å šäœãä¿åããå Žåã¯ã©ãã§ããããïŒ ããŸããŸãªããŒã¿ããŒã¹ã¯ãšãªãäœæããæ€çŽ¢ã§ããWebã¢ããªã±ãŒã·ã§ã³ã¯ã©ãã§ããããã
ããã§ã¯ãWeb Storageã䜿çšããŠå±éããããšã¯ã§ããŸãã-ããä¿¡é Œæ§ã®é«ããã®ãå¿ èŠã§ãã ããªãã¡-WebSQLã WebSQLã¯ãJavascriptãšSQLã®çµã¿åããã䜿çšããŠããŒã¿ãä¿åã§ããããŒã«ã«SQLiteããŒã¿ããŒã¹ã§ãã
WebSQLããŒã¿ããŒã¹ã§ã®äœæ¥
ãŸãæåã«ããã©ãŠã¶ãWebSQLããµããŒãããŠããããšã確èªããŸããïŒ ããã¯ã window.openDatabaseããããã£ã䜿çšããŠå®è¡ã§ããŸãã
if (window.openDatabase){ //rest of your code } else{ alert("It seems your browser does not have support for WebSQL. Please use a browser which does, otherwise parts of this application may not run as intended."); //or any other similar message }
ããŒã¿ããŒã¹ãäœæããŠéã
次ã®ããã«ã openDatabaseã³ãã³ãã䜿çšããŠããŒã¿ããŒã¹ãäœæããŠéãããšãã§ããŸãã
var db = openDatabase("food_db", "1.0", "Web SQL Storage Demo Database", 1*1024*1024); // creates a database called 'food_db' with version number 1.0, description as 'Web SQL Demo Database' and a size of 1MB.
ãããŒãžã§ã³ã1.0ã®food_dbããŒã¿ããŒã¹ãäœæãããµã€ãºã1 MBã®ãWeb SQL Storage Demo Databaseãã®èª¬æãè¿œå ããŸããã dbå€æ°ã¯ãåŒãç¶ã䜿çšããããŒã¿ããŒã¹ãªããžã§ã¯ããžã®ãã€ã³ã¿ãŒã§ãã
泚ïŒããŒã¿ããŒã¹ã®ãµã€ãºã¯ãã€ãåäœã§èšå®ãããŸãã ãããã£ãŠããµã€ãºã1 * 1024 * 1024ã®åœ¢åŒã§æ±ºå®ããŸãããããã¯1 MBã§ãã 4 MBãªã©ã®ãµã€ãºãèšå®ããå¿ èŠãããå Žåã¯ããããã4 * 1024 * 1024ã®å€ãæå®ããå¿ èŠããããŸãã |
ããŒã¿ããŒã¹ãæäœãã
ããŒã¿ããŒã¹ãäœæããŠéããŸããã ããã§ãSQLã³ãã³ãã䜿çšããŠããŸããŸãªæäœãå®è¡ã§ããŸãã ããŒã¿ããŒã¹ãªããžã§ã¯ãã®ãã©ã³ã¶ã¯ã·ã§ã³ïŒïŒé¢æ°ãåŒã³åºãããšã§æäœãå®è¡ããŸãïŒãã®äŸã§ã¯dbã§ã ïŒã 圌女ã®åŒã³åºãã¯ã executeSQLïŒïŒã䜿çšããŠããŸããŸãªã³ãã³ããå®è¡ãããã€ã³ã¿ãŒãšããŠãªããžã§ã¯ããè¿ããŸãã ãã®ã³ãã³ãã®æ§æã¯æ¬¡ã®ãšããã§ãã
executeSql(sqlStatement, arguments, callback, errorCallback);
ãã©ã¡ãŒã¿ãŒã®ãã¡ã sqlStatementã®ã¿ãå¿ é ã§ãæ®ãã¯ãªãã·ã§ã³ã§ãã
ãããã£ãŠãããšãã°ãããŒãã«ãäœæããå Žåã次ã®ããã«èšè¿°ããå¿ èŠããããŸãã
... db.transaction( function(t){ // This is the callback with "t" as the transaction object t.executeSql("CREATE TABLE IF NOT EXISTS cal_list (food_name TEXT PRIMARY KEY, calories REAL, servings TEXT)"); } ); ...
ãã®ã³ãŒãã¯ããã£ãŒã«ãfood_name ã calories ãããã³servingsãæã€ããŒãã«cal_list ïŒååšããªãå ŽåïŒãäœæããŸãã
ããŒãã«ãžã®ã¬ã³ãŒãã®è¿œå
ããŒãã«ã«ã¬ã³ãŒããè¿œå ããããã®ã¯ãšãªã®å®è¡ã¯ãWebSQLã®ç°¡åãªã¿ã¹ã¯ã§ãã äŸãèããŠã¿ãŸãããïŒ
var food_name = "pizza"; var amount_of_calories = 320; var serving_size = "one slice"; db.transaction( function(t){ t.executeSql("INSERT INTO cal_list VALUES (?, ?, ?)", [food_name, amount_of_calories, serving_size]); } );
æåã®çå笊ã¯food_nameãã©ã¡ãŒã¿ãŒã«ãã£ãŠãšã¹ã±ãŒãããã2çªç®ã¯amount_of_caloriesã«ãã£ãŠãšã¹ã±ãŒãããã3çªç®ã¯serve_sizeã«ãã£ãŠãšã¹ã±ãŒããããŸã ã ãã®ã³ãŒãã¯ãå€ãpizza ã 320ããã³1ã€ã®ã¹ã©ã€ã¹ã«å¯Ÿå¿ããåãå«ããšã³ããªãcal_listããŒãã«ã«è¿œå ããŸãã
å¥ã®ãªã¯ãšã¹ããå®è¡ããŠã¿ãŸããã-ããŒã¿ãåä¿¡ããŸãïŒ
var min_cal_amount = 300; ... t.executeSql("SELECT * FROM cal_list WHERE calories > ?", [min_cal_amount]);
ãã®ã³ãŒãã¯ã¯ãšãªãå®è¡ããŠã ã«ããªãŒå€ã300ãè¶ ãããã¹ãŠã®è¡ãéžæããŸããçå笊ã¯min_cal_amountå€æ°ããšã¹ã±ãŒãããŸãã
ã¯ãšãªçµæã®åŠç
ããŠãããã§ãããŒã¿ãèšé²ããããŒãã«ãåããããŒã¿ããŒã¹ãäœæããŸããã次ã«ãçµæãç §äŒããŠè¡šç€ºããããšæããŸãã éåžžã1ã€ã®SQLã¯ãšãªã«å¯ŸããŠå€æ°ã®çµæãååŸããŸãããããã®çµæãäœããã®æ¹æ³ã§åŠçããŠãããŒãã«ãŸãã¯ä»ã®æ§é åããããã©ãŒã ã§ããŒãžã«è¡šç€ºããå¿ èŠããããŸãã executeSQLïŒïŒé¢æ°ã®3çªç®ã®ãã©ã¡ãŒã¿ãŒã¯ãã¯ãšãªã®æåã決å®ããŸãã 以äžã¯ãçµæãåŠçããäŸã§ãã
var list = document.getElementById("thelist"); var food; var min_cal_amount = 400; var serving_size; db.transaction( function(t){ t.executeSql("SELECT food_name AS food, calories AS amount_of_calories, servings as serving_size FROM cal_list where calories > ?" ,[min_cal_amount], function(t,r){ for (var i=0; i < r.rows.length; i++){ food = r.rows.item(i).food; amount_of_calories = r.rows.item(i).amount_of_calories; serving_size = r.rows.item(i).serving_size; list.innerHTML +="<li>"+food+" has "+amount_of_calories+" KCAL worth of calories.</li>"; } }, function(t,e) {alert(e.message);}) } );
ãŸãã r.rows.lengthãä»ããŠãªã¯ãšã¹ãã®çµæãšããŠèŠçŽ ã®æ°ã決å®ãã0ãããã®å€ã«é²ã¿ãŸãã åã¢ã€ãã ã¯r.rows.itemïŒiïŒããã¢ã¯ã»ã¹ã§ããŸããiã¯è¡çªå·ã§ãã ååãåãæ¹æ³ã§ååŸã§ããŸãã foodåã®å€ãååŸããã«ã¯ã r.rows.itemïŒiïŒ.foodãªã©ãä»ã®åã«äœ¿çšããŸãã
ãã¹ãŠãäžåºŠã«äœ¿çšããŸã
Web StorageãApplication Cacheãããã³WebSQLãäžç·ã«äœ¿çšããããšãã§ããŸãã å¯èœæ§ã¯ãããŸããããã¹ãŠè§£æ±ºããå¿ èŠã®ããã¿ã¹ã¯ã«äŸåããŸãã ããšãã°ãäžéšã®ãŠãŒã¶ãŒèšå®ã®ã¿ãä¿åããå ŽåãWebSQLã䜿çšããããšã¯äžèŠã§ãã ãã®ãããªç®çã«ã¯ãWebã¹ãã¬ãŒãžãæé©ã§ãã
ãã ãã倧éã®ããŒã¿ããããäœããã®æ¹æ³ã§åŠçããå¿ èŠãããå Žåã¯ãWebSQLã䜿çšããæ¹ãè«ççã§ãã
3ã€ã®ãã¯ãããžãŒãã¹ãŠãäžç·ã«äœ¿çšããã«ããªãŒã®ãµã³ãã«ããŒãžã«ã¢ã¯ã»ã¹ããŠãã ãããããŒã¿ããŒã¹ã¯Web Storageã«æ ŒçŽãããŠãããããããŒãžãéããããªããŒããããããŠãæ€çŽ¢ã§ããŸããAppCacheãšWebSQLã䜿çšããŠãªãã©ã€ã³ã§äœæ¥ã§ããŸãã
æ³šïŒ operaïŒwebdatabasesãªã³ã¯ãã¯ãªãã¯ãããšãOperaã§äœ¿çšãããŠããããŒã¿ããŒã¹ã«é¢ããæ å ±ãåå¥ã«ååŸããŠç®¡çã§ããŸãã ãŸããWeb Storageã䜿çšããŠãã©ãŠã¶ã«ããŒã¿ãä¿åãããã¡ã€ã³ã«é¢ããæ å ±ãååŸãã operaïŒwebstorageãªã³ã¯ãã¯ãªãã¯ããŠç®¡çããŸãã |
åŸ ã£ãŠãã ãã... WebSQLä»æ§ã¯æ¿èªãããŠããŸããïŒ
ãŸã 決ãŸã£ãŠããªãã ãã ãããã®ãã¯ãããžãŒããã©ãŠã¶ãŒãšããã€ã¹ã®ãªã¹ãã«æ¢ã«é©çšã§ããŸãã ãã®ãããªã¯ãã¹ãã©ãããã©ãŒã ã®ãµããŒãããªãIndexedDBã«ã€ããŠèšããªãããšã ä»æ§ã®æ¿èªãåŸ ã€ããšã ããæ®ããŸãããããã¯ããã«èµ·ãããŸãã
FirefoxãInternet Explorerãªã©ã®äžéšã®ãã¹ã¯ãããããŒãžã§ã³ã®ãã©ãŠã¶ãŒã¯WebSQLããµããŒããããIndexedDBã§åäœããããšã«æ³šæããããšãéèŠã§ãã ãã®å Žåãæåã«WebSQLã䜿çšã§ããã®ã¯ãã¹ããŒããã©ã³çšã®ãªãã©ã€ã³ããŒã¿ã¹ãã¬ãŒãžã§ããOperaMobile 11ãã©ãŠã¶ãŒãšAndroidããã³iOSãã©ãããã©ãŒã çšã®WebKitãã©ãŠã¶ãŒããµããŒããããŠããŸãã
WebSQLã®è¯ãç¹ã¯ããã©ãŠã¶ã§ã¹ã¿ã³ãã¢ãã³ããŒã¿ããŒã¹ãäœæããããã®äŸ¿å©ãªããŒã«ãæäŸããããšã§ãã ç°¡åã«ç¿åŸããŠäœ¿çšã§ããè€æ°ã®ãã©ãŠã¶ã§ããã«åäœããã¹ã¿ã³ãã¢ãã³ã®Webã¢ããªã±ãŒã·ã§ã³ãè¿ éã«éçºã§ããŸãã
ãããã«
Webã¢ããªã±ãŒã·ã§ã³ã¯çŸåšãã¢ããªã±ãŒã·ã§ã³ãã£ãã·ã¥ãWebã¹ãã¬ãŒãžãWebSQLããŒã¿ããŒã¹ãªã©ã®ãã¯ãããžãŒã䜿çšããŠãå®å šã«èªåŸçãªã¢ãŒãã§åäœããæ©äŒãæã£ãŠããŸãã ãã¡ã€ã«ããªãã©ã€ã³ã§äœ¿çšããã«ã¯ããã¡ã€ã«ããã£ãã·ã¥ããããã®ã¢ããªã±ãŒã·ã§ã³ãã£ãã·ã¥ãå¿ èŠã§ãã Web Storageã¯å°éã®æ å ±ãä¿åããããã®ãã®ã§ãããWebSQLã¯å€§éã®ããŒã¿ãæäœããããã®äŸ¿å©ãªããŒã«ã«ãªããŸãã éçºè ã¯ãããŒãºã«å¿ããŠããããã®ãã¯ãããžãŒã®ããŸããŸãªçµã¿åããã䜿çšããŠãã¹ã¿ã³ãã¢ãã³ã¢ããªã±ãŒã·ã§ã³ãäœæã§ããŸãã
ãã®æè¡ã¯ææã§ãã ãããŠããã€ãã®ããã«ãã¬ãŒã¹ããããŸã... WebSQLãšIndexedDBããããã®èšåã¯ãã§ã«ããã«ãããŸãã 圌ããäžçãããè¯ãå Žæã«ã§ããããã«:)