HTML and CSS Reference
In-Depth Information
Thought experiment
Combining the JavaScript APIs
In this thought experiment, apply what you've learned about this objective. You can
find answers to these questions in the “Answers” section at the end of this chapter.
Consider an application such as a running or walking utility that measures the dis-
tance traveled. One feature of this application is to play back a completed route to
users if they so choose. How would you use the Geolocation API and Web Storage
API in combination to save the data points as users travel the route so the applica-
tion can play them back later? (Assume that you're interfacing with map software
on which to draw the lines.)
Objective summary
The new Web Storage API enables you to store data locally on the client computer.
Web Storage supports both localStorage and sessionStoroage .
Data in Web Storage is stored as name and value pairs.
The AppCache API provides a way to make webpages available when users are offline.
The AppCache manifest defines what's available offline.
The Geolocation API provides a way to integrate location services into a webpage.
The Geolocation API provides two methods: getPosition and watchPosition .
Objective review
Answer the following questions to test your knowledge of the information in this objective.
You can find the answers to these questions and explanations of why each answer choice is
correct or incorrect in the “Answers” section at the end of this chapter.
When using the Web Storage API, where should you store data to ensure that it's
cleared when the user closes the browser?
A. localStorage
B. cookieStorage
C. sessionStorage
1.
A hidden input element
D.
 
 
Search WWH ::




Custom Search