Web SQL This is a mock database browser. You can use the JS operation SQL to complete the data read and write, but this thing is not many, now support the browser, and its specifications have been discontinued support. Looks like its foreground is not very bright.
Specifications: Http://www.w3.org/TR/webdatabase/#dom-sqltransaction-sync-executesql (now has stopped updating, the organization did not want to know the direction of development)
Supported browsers and version numbers:
Safari (3.2+)
Chrome (3.0+)
Opera (10.5+)
Pass through conventional offline applications use WebStorage, but WebStorage has a very large limitation, for example, storage space. Domain security mechanisms, and so on. There are not so many restrictions on Web SQL. It has more storage space (can define its own settings), cross-domain reading and writing, storage structure, such as freedom. And it is convenient to use SQL to read and write.
Demo Sample Code
<! DOCTYPE html>, ?
,?) ', [Name, Message, Time],function (TX, RS) {//document.getelementbyid ("msg"). InnerHTML = "Save data successfully ! ";}, Function (TX, error) {alert (Error.source +":: "+ error.message); }); }); }//Save data Function SaveData () {var name = document.getElementById (' name '). Value; var memo = document.getElementById (' Memo '). Value; var time = new Date (). GetTime (); AddData (Name,memo,time); ShowAllData (); }//Delete table data function DeleteData () {Db.transaction (function (TX) {tx.executesql ("Delete from Msgdata", [],function (TX, RS) {//alert ("Data deleted successfully!"); }, Function (TX, error) {alert (Error.source + "::" + error.message); });}); ShowAllData ();} </script>
For Websql. Because of the broad rules of reading and writing, it is a very big security problem, cross-domain read, XSS attacks, SQL injection, etc. are very headache. So what kind of data can be stored and stored. Need to be considered carefully. The company has now stopped the update of the specification, may not be comfortable with the current specification design, and now the browser vendor support is not high, perhaps the development. is still unknown.
Copyright notice: This article blog original article. Blogs, without consent, may not be reproduced.
HTML 5 using Demo sample in Web SQL