HTML5 and CSS3, Second Edition
To start, we need to code up the interface. html5_indexedDB/index.html <!DOCTYPEhtml> <html> <head> <metach ...
html5_indexedDB/stylesheets/style.css #container{ margin:0 auto; width:80%; } #sidebar,#main{ display:block; float:left; } #main ...
Creating and Connecting to the Database Create the file javascripts/notes.js. We’ll put all of our application logic in this fil ...
request object has a success() callback that fires when the connection is estab- lished, and an error() method that fires when t ...
In the future, if we change the version to something else, the onupgradeneeded() callback will fire again. This gives us an easy ...
note’s title and body. We pass both of those to addNoteToList() to add the note to the sidebar. We define addNoteToList() like t ...
This fires off the getNote() method, which takes in the ID and gets the single note from the database. We define getNote() like ...
having edited an existing one. We first add an event handler when the New button is clicked: html5_indexedDB/javascripts/notes.j ...
"title":title, "note":note, }; vartransaction= db.transaction(["notes"],"readwrite"); varstore= transaction.objectStore("notes") ...
Deleting records is almost the same. We need a handler for the delete event: html5_indexedDB/javascripts/notes.js $("#delete_but ...
request.onsuccess=function(event){ $("#notes").empty(); }; request.onerror=function(event){ alert("Unableto clearthingsout."); } ...
those browsers do support Web SQL Databases. To use IndexedDBShim, we download the minified version and load it in the <head& ...
Tip 29 Tip 29. Working Offline With HTML5’s Offline Web Applications support,^7 we can use HTML and related technologies to buil ...
javascripts/jquery-1.9.1.min.js When we change our code, we need to modify the manifest so the browser knows to fetch the new ve ...
Be sure to investigate the specification. The manifest file has more complex options you can use. For example, you can specify t ...
html5_offline/offlinetest.html window.addEventListener("offline",function(e){ alert("offline"); }, false); window.addEventListen ...
CHAPTER 10 Creating Interactive Web Applications Beyond the new markup, styles, and multimedia capabilities of HTML5 and CSS3 li ...
Geolocation Gets latitude and longitude from the client’s browser. [C5, F3.5, S5, O10.6, iOS3.2, A2.1] Drag and Drop Provides fo ...
Tip 30 Tip 30. Preserving History The HTML5 specification introduces an API to manage browser history.^1 With it, we can add ent ...
The second argument is a title that we can use to identify the state in our history. It has nothing to do with the page’s <ti ...
«
6
7
8
9
10
11
12
13
14
15
»
Free download pdf