Thursday, 7 December 2017

Save Information with Cookies

Cookies were originally designed to enable a server to save information on the client's disk. When the client contacted that same host at a later time, the previously saved cookie would be sent back to the server

Cookies are therefore useful if a browser connection is interrupted and you want to pick up where you left off. They are also useful in the event the server crashes and later wants to pick up where it left off. Cookies are now available for general use in JavaScript.

Although servers can write named cookies one at a time, JavaScript cannot. You can set an individual named cookie with the statement, document.cookie='cookiename=xxxx', but when you retrieve document.cookie, you get a string consisting of all of the cookies.

Currently, the only way to retrieve an individual cookie is to search through the entire set of cookies obtained from document.cookie. Consequently, it helps to add a prefix or suffix to the names of your cookies with little-used characters. This makes them easy to find with IndexOf().

The only method you can use to store variables between invocations of Netscape Navigator and Internet Explorer v3 is the cookie approach. This is also the only approach that works with windows in different hierarchies.

Cookies were originally designed to enable a server to save information on the client's disk but now they are available for the general use in javascript.

The table of contents serves as your control center.Also all article links are listed here.
When the user passes the mouse over one of the links, a line of text describing that link appears in the browser's status bar.

One of the tremendous advantages of hypertext is its ability to link together many pieces of information in a nonlinear fashion.
However, sometimes this easy access to information can have unfortunate and cumbersome side effects.

Sophisticated applications often require both data presentation and data storage/management capabilities. Unfortunately, information or parameter storage is particularly difficult.

In Netscape data may be temporarily saved between reloads using the location.search property, and also on the command line. In addition, both Netscape and Microsoft provide a persistent means of storage via cookies.

Because Netscape is extremely security-conscious, it has made it difficult to store or load data-even between document reloads.One method of storing simple data between document reloads via a string saved in location.search.

This special location.search property is often referred to as the command line. A script can retrieve this string and redraw itself based on information in the string.

Cookies are lines in a file that the browser enables you to write to disk. This file will be named cookies.txt on a Windows machine, or just cookies on a UNIX or Macintosh. Under Netscape Navigator this file will be in your Netscape directory or folder. Cookies are limited in size and number.

Nevertheless, cookies are extremely useful. They are frequently used in the same way as a Windows .ini file, a Macintosh Preferences file, or a UNIX.rc file.

When arraySubParms(astr) receives a string, it immediately finds the string's length and uses that value to chop off the first character, which is the question mark (?), that starts the location.search string.
It then begins a loop that cycles through every character in the string with the statement ccstr = astr.substring

The document.write() statement serves as a placeholder, and should be replaced with your own code.
Make a copy of this file every time you need to create a new page and you'll have all the basic tags you need for JavaScripting.