View Full Version : Browser Navigation Demonstrator

12-22-2010, 10:39 PM
I have been given a scenario to do as a bit of work for my course the scenario is below:

The communication protocols on the Internet such as HTTP are stateless. State can be maintained in a number of ways within the client server architecture. One weak technique used by the HTTP client to maintain state is to keep a record of previously visited Uniform Resource Locators. These locations are stored by the client and accessed via the backward and forward button of the web browser.

Design Brief
Design a system that models the way the client browser maintains the aforementioned state. The system must allow the user to enter a new URL into the system and either go back to a URL loaded previous to the current URL or go forward to a URL loaded after the current URL. The storage mechanism used by the browser must include two stacks (one backward and one forward) both of which support the following behaviour:

Pop item from stack
Push item onto stack
Empty a stack

Generally speaking, the backward stack stores items of previously visited URLs and the forward stack stores items moved from the backward stack to the forward stack.

The system must allow the user to interact in three ways: enter a new URL, recover URLs from the backward stack; and recover URLs from the forward stack. The actions of the user should produce the following results:

Entering URL (via an address bar)
Push current document onto backward stack
Empty forward stack
Recover URL from backward stack
Push current document onto forward stack
Pop backward stack
Load popped URL as current document
Load URL from forward stack
Push current document onto back stack
Pop forward stack
Load popped URL as current document
Additional Rules
A new Window has empty stacks
Popping an Empty Stack is not fatal

Programming isnt my strongest skill and wanted to know where to start off with doing this and what kind of code to use.


Old Pedant
12-22-2010, 11:47 PM
If you are supposed to do this in the browser, then you only have one real choice for "kind of code": JavaScript.

Maybe you should start by creating a LIFO in Javascript code?

Philip M
12-23-2010, 08:55 AM
This may point you in the right direction:-


All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.