Welcome to Bucaro TecHelp!

Bucaro TecHelp
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact RSS News Feeds News Feeds

Victims of Sandy Hook

Stop the Slaughter of Innocents. Congress is bought and paid for by gun lunatics and gun promotion groups. If you want to live in a safe America, help buy Congress back for America. Send a donation to Mayors Against Illegal Guns, 909 Third Avenue, 15th Floor New York, NY 10022

The Browsers History Object

The Back and Forward buttons are related to the browser's history object. As the user surfs the Web, the history object maintains a list of the URLs they visited. When you select the browser's History menu item you can view the contents of the history object.

The history object is not in the browser's DOM (document object model) because it's not a visual object, it's a list of past pages that were loaded into the browser. For security reasons, there is very little you can do with the history object, for example you can't examine the URL's of the previous websites that the user visited.

The history object's back() method moves the browser back one page in the history list. Shown below is the code for a Back button using the history object's back() method:

<input type="button" value="Back" onclick="history.back()" />

If the user executed the history object's back() method, or clicked the browsers Back button at least once, then the browser will be at a previously visited URL in the history list and the history object's forward() method can be used to move the browser forward one page in the history list.

Shown below is the code for a Back button using the history object's forward() method:

<input type="button" value="Forward" onclick="history.forward()" />

The history object's go() method accepts an integer value that moves the browser that many pages in the history list from its current location in the list. If the value passed to the go() method is a negative value, it will move the browser backward in the history list. If the value passed to the go() method is a positive value, it will move the browser forward in the history list.

Shown below is the code for a Back button using the history object's go() method that moves the browser backward 2 pages in the history list:

<input type="button" value="Back" onclick="history.go(-2)" />

Passing the value 0 to the go() method reloads the current page, which may be something you need to do in code, for example, if a user has not completed a form properly.

RSS Feed RSS Feed



Follow Stephen Bucaro Follow @Stephen Bucaro


Web Design Sections

Fire HD
[Site User Agreement] [Privacy Policy] [Site map] [Search This Site] [Contact Form]
Copyright©2001-2016 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268