You there, Tippy!
We're slowly getting to the bottom of this script. Now we'll get into the history statement right at the end and wrap it up. Here's the script so you can familiarize yourself again:
But how does the browser know that? It knows it because every place you go, in the order you go, is kept in a file called "history." So, when you start to type in a URL, if you type in something that's similar to an address that's already in the history folder, the browser attempts to be nice and finish it off for you.
Notice in this script that not only is the browser being told to go somewhere within the history file, it is being told to go somewhere specific. In this case it is to go one back. See that (-1)?
And That's That
- You log into the page and the script is loaded into the browser.
- The function is enacted upon the loading of the page.
- A confirm box pops up with text written on it.
- If the person chooses OK, the script is done and the page loads.
- If the person chooses Cancel, then the history.go is enacted and the browser goes one page back or reloads the page the user just came from.
Next Time: A New Script! Browser Choice