HTML Goodies: Script Tip: Week 9
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:
If you've used any of the 3- or 4-level Navigator or Explorer browsers, then you've probably already seen this "history" in action. You go up to the location bar at the top of the browser and type in part of a URL and poof! The remainder of the address just pops up.
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 Week: A New Script! Browser Choice
Do YOU have a Script Tip you'd like to share? How about suggesting a Script Tip to write about? I'd love to hear it. Write me at: email@example.com.
HTML Goodies 30-Step Primer Series
and take the knowledge home with you in
on your Web pages here!