jschap08 - Chapter 8: Cookies and Security JavaScript -...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 8: Cookies and Security JavaScript - Comprehensive
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Previewing the Virtual Zoo Program To preview the Product Registration program and the Home Page program code refer to pages 394 and 395 of the textbook.
Background image of page 2
Section A: State Information and Cookies
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Objectives In this section, the students will learn: About state information About the String object How to save state information with query strings How to create and read cookies
Background image of page 4
State Information HTTP was originally designed to be stateless, in that no persistent data was stored about a visit to a Web page Although this stateless design was efficient, it was also limiting, since a Web server could not remember individual user information There are many reasons for maintaining state information, including: Individual Web page customization based on user preferences Temporary storage of information when navigating within a multipart form
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
State Information Bookmarks for returning to specific locations within a Web site Shopping carts that store order information for commercial Web sites Storage of user Ids and passwords Counters to keep track of how many times a user has visited a site There are several methods of maintaining state information: Hidden form fields Query strings Cookies
Background image of page 6
Commonly Used Methods of the String Object
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Commonly Used Methods of the String Object
Background image of page 8
The String Object The string object contains methods used for manipulating text strings The String object also contains a single property the length property , which returns the number of characters in a string To make state information stored in long strings of text usable, the long strings usually must be parsed Parsing is the act of extracting characters or substrings from a larger string
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
String Object Examples
Background image of page 10
String Object Examples in a Web Browser
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Saving State Information with Query Strings A query string is a set of name=value pairs appended to a target URL, and consists of a single text string containing one or more pieces of information The search property of the Location object contains a URL’s query or search parameters To use the data contained in a query string, you must manipulate the string using the String object’s methods and length property To create a query string, add a question mark (?) immediately after a URL, followed by name=value pairs for the information you want to preserve
Background image of page 12
Saving State Information with Query Strings The following code provides an example of an <A>…</ A> tag pair that contains a query string with three name=value pairs: <A HREF=“http://www.URL.com/TargetPage.htlm?firstName = To modify the Product Registration program so that customer information is passed as query strings instead of being shared in hidden form fields, refer to the instruction on pages 401 to 403 of the textbook To modify the Productinfo.html file use the steps on pages 403 and 404 of the textbook
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 14
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/13/2011 for the course MIS 241 taught by Professor Tse during the Spring '11 term at Moraine Valley Community College.

Page1 / 65

jschap08 - Chapter 8: Cookies and Security JavaScript -...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online