Training Guide: Programming in HTML5 with JavaScript and CSS3 Ebook
Answers CHAPTER 15 579 Answers This section contains the answers to the lesson review questions in this chapter. Lesson 1 Corre ...
580 CHAPTER 15 Local data with web storage Correct answer: D A. Incorrect: Web storage does not support indexing. B. Incorrect: ...
581 Chapter 16 Offline web applications CHAPTER 16 Offline web applications I n the preceding chapter, you learned about the mos ...
582 CHAPTER 16 Offline web applications Lesson 1: Working with Web SQL Web SQL is arguably one of the most powerful options avai ...
Lesson 1: Working with Web SQL CHAPTER 16 583 To start communication with a database, use the openDatabase method, which returns ...
584 CHAPTER 16 Offline web applications Adding a table You can add an authors table to the Library database created earlier. You ...
Lesson 1: Working with Web SQL CHAPTER 16 585 ■■readTransaction Works similarly to the transaction method but allows read com- m ...
586 CHAPTER 16 Offline web applications function itemInserted(transaction, results) { alert("Id: " + results.insertId); } var fi ...
Lesson 1: Working with Web SQL CHAPTER 16 587 var db = openDatabase('Library', '2.0', 'My library', 5 * 1024 * 1024); db.transac ...
588 CHAPTER 16 Offline web applications displayResults) }); Using JOIN commands Web SQL includes support for traditional JOIN st ...
Lesson 2: Working with IndexedDB CHAPTER 16 589 ■■Schema migration support is available by using the changeVersion() method. ■■W ...
590 CHAPTER 16 Offline web applications stores. Much like Web SQL, interfacing with the database is transaction-based and requir ...
Lesson 2: Working with IndexedDB CHAPTER 16 591 onerror event that can notify your application if an error occurs during an atte ...
592 CHAPTER 16 Offline web applications Using the keypath property One important property of the parameter object is the keypath ...
Lesson 2: Working with IndexedDB CHAPTER 16 593 The createIndex method is called during a database migration, within the onupgra ...
594 CHAPTER 16 Offline web applications var trans = db.transaction('authors', 'readonly'); Example of a transaction being opened ...
Lesson 2: Working with IndexedDB CHAPTER 16 595 function updateAuthor() { var trans = db.transaction('authors', 'readwrite'); va ...
596 CHAPTER 16 Offline web applications request.onerror = function(response) { // display error }; } Understanding cursors The o ...
Lesson 2: Working with IndexedDB CHAPTER 16 597 handler again, this time with the next record in the results. When it reaches th ...
598 CHAPTER 16 Offline web applications ■■lowerOpen Optional; can be true or false. If true, the lower end of the range is consi ...
«
26
27
28
29
30
31
32
33
34
35
»
Free download pdf