Training Guide: Programming in HTML5 with JavaScript and CSS3 Ebook

(Nora) #1

Answers CHAPTER 15 579


Answers


This section contains the answers to the lesson review questions in this chapter.

Lesson 1



  1. Correct answer: D
    A. Incorrect: The use of a different host (www2 instead of www) disallows this URL
    from access.
    B. Incorrect: The port number must match the origin port nmber.
    C. Incorrect: Matching protocols must be used. In this answer, https is used rather
    than http.
    D. Correct: Because this example uses the same origin, it will have access to the same
    data storage space.
    E. Incorrect: This example does not have a matching host and would not be allowed
    access.

  2. Correct answer: B
    A. Incorrect: The cookie value limit is 4 KB.
    B. Correct: The recommended limit is 5 MB, although the browser vendor can deter-
    mine the respective limits.
    C. Incorrect: If websites could store 500 MB of data on the client machine, drastic
    performance degradation would result.
    D. Incorrect: Internet Explorer supports 10 MB, but that’s not the recommended limit.

  3. Correct answer: A
    A. Correct: The clear() method removes all existing key/value pairs existing for the
    origin.
    B. Incorrect: The removeAll() method does not exist.
    C. Incorrect: The abandon() method does not exist.
    D. Incorrect: The reset() method does not exist.

  4. Correct answer: A
    A. Correct: Nearly all modern browsers support web storage (localStorage and
    sessionStorage).
    B. Incorrect: Some popular browsers (namely Chrome and Safari) support Web SQL,
    but neither Internet Explorer nor Firefox supports it yet.
    C. Incorrect: Although IndexDB seems to be gaining support ahead of Web SQL, it is
    yet to be adopted by Safari or some of the major mobile browsers.
    D. Incorrect: With only Chrome as its strongest supporter, FileSystem API is the least
    adoption option.

Free download pdf