3

I want to create a web page so that it can store some data offline. I want to use this file in tablets as well as smart phones. can any body suggest some offline data storage for HTML and also its examples and tutorials. I have Googled about websql in html5. But didn't get any simple answer.

Amir
  • 1,328
  • 2
  • 13
  • 27
ess
  • 663
  • 3
  • 9
  • 17
  • 1
    Duplicate: http://stackoverflow.com/questions/3936736/html5-offline-storage-file-storage-directories-and-filesystem-api – Ali Gajani Dec 30 '13 at 06:08
  • 2
    Simplest would be `localStorage`, which is just a persistent key-value store (`localStorage['key'] = 'value';`). But for more complex data `webSql` is good (however it's not supported by all browsers). Googling `websql example` gives plenty of simple examples/tutorials. Also keep in mind that _'persistent'_ on smartphones/tablets can mean _'until the cache is cleared'_. – towr Dec 30 '13 at 06:28
  • can u suggest any example link for indexeddb – ess Dec 30 '13 at 07:32

1 Answers1

1

If you're using HTML 5 here's an example pulled from W3Schools:

// Store
localStorage.lastname = "Smith";
// Retrieve
document.getElementById("result").innerHTML=localStorage.lastname;

[Source]: W3Schools

For a more comprehensive guide visit DiveintoHTML5

Or here: http://www.html5rocks.com/en/features/storage You have three main choices for storage:

  • Name/Pair Storage within the browser (see the W3 link)
  • IndexedDB [Source]
  • Web SQL DB [Source]

I hope you find the best solution for your project!

Community
  • 1
  • 1
ZeroBased_IX
  • 2,667
  • 2
  • 25
  • 46