Javascript History, Location and Navigator Object

In Javascript, two important object are window and document objects. But few more other useful objects are available in Javascript.

Javascript History Object

The history object specifies the previous URLs requested by the browser. The history object contains a list of strings, which are the URLs accessed by the browser.

The useful methods in history object are:

Javascript History Object Methods

Name Description
go Takes a number as an argument and load the URL corresponding to it.
back Use to move previous page URL.
forward Use to move next page URL.

There are few properties, which can be accessed in the history object.

Javascript History Object Properties:

Name Description
current This represents the current page url in the history object.
previous This represents the previous page url in the history object list, if any.
next This represents the next page url in the history object list, if any.
length This returns the number of objects in the history list.

Javascript Location Object

The location object specifies the current URL.

There are few properties, which can be accessed in the history object.

Javascript Location Object Properties

Name Description
href This represents the URL of the current page .

The location object also contains useful methods.

Javascript Location Object Methods

Name Description
reload This method forces to reload of the windows current page.
replace This method load a perticular URL replacing the current history entry.

Javascript Navigator Object

This defines the name and version of the client internet browser or web navigator program that is being used and the mime types supported by it.

It also defines a list of plug-ins available to the system.

The navigator object contains useful properties.

Javascript Navigator Object Properties

Name Description
appCodeName This specifies the code name of the browser.
appName This specifies the name of the browser.
appVersion This specifies version information for the browser.
language The languge the user is using such as "en-us".
mimeTypes An array of MIME type descriptive strings that are supported by the browser.
platform A description of the operating system platform. In my case it is "Win32" for Windows 95.
plugins An array of plugins installed in the browser.
userAgent String passed by browser as user-agent header.

The navigator object also contains useful methods

Javascript Location Object Methods

Name Description
javaEnabled This returns a boolean telling if the browser has JavaScript enabled.
taintEnabled This returns a boolean telling if the browser has tainting enabled.