Andy Jarrett // Code. Develop. Create.

A quick tutorial for WebSQL

I've created a gist which gives you the basics for getting to grips with WebSQL. It's heavily commented and shows you the three core methods used (openDatabase, transaction, executeSql) and how to:

  1. Create a database
  2. Create a table
  3. Insert a record
  4. Get the data back in to HTML

Don't forget that WebSQL is currently only supported on Chrome, Opera, iPhone, and Android. It's not on Firefox(!) or Internet Explorer (shock).

To see your results, right-click on the page and Inspect Element to bring up the following window and go to the Resources tab. Under Databases you should find a table called fightclub

inspect element



I’m here, learning and working away. If you liked this content and want to keep me going, consider buying me a coffee. Your support keeps this site running and the coffee brewing! ☕️