Wednesday, 28 December 2011

JavaScript Navigator,screen,History & Location Object in Browser


Navigator Object

The navigator object contains information about the browser.
Note Note: There is no public standard that applies to the navigator object, but all major browsers support it.

Navigator Object Properties

PropertyDescription
appCodeNameReturns the code name of the browser
appNameReturns the name of the browser
appVersionReturns the version information of the browser
cookieEnabledDetermines whether cookies are enabled in the browser
platformReturns for which platform the browser is compiled
userAgentReturns the user-agent header sent by the browser to the server

Navigator Object Methods

MethodDescription
javaEnabled()Specifies whether or not the browser has Java enabled
taintEnabled()Specifies whether or not the browser has data tainting enabled

Screen Object

The screen object contains information about the visitor's screen.
Note Note: There is no public standard that applies to the screen object, but all major browsers support it.

Screen Object Properties

PropertyDescription
availHeightReturns the height of the screen (excluding the Windows Taskbar)
availWidthReturns the width of the screen (excluding the Windows Taskbar)
colorDepthReturns the bit depth of the color palette for displaying images
heightReturns the total height of the screen
pixelDepthReturns the color resolution (in bits per pixel) of the screen
widthReturns the total width of the screen

History Object

The history object contains the URLs visited by the user (within a browser window).
The history object is part of the window object and is accessed through the window.history property.
Note Note: There is no public standard that applies to the history object, but all major browsers support it.

History Object Properties

PropertyDescription
lengthReturns the number of URLs in the history list

History Object Methods

MethodDescription
back()Loads the previous URL in the history list
forward()Loads the next URL in the history list
go()Loads a specific URL from the history list

Location Object

The location object contains information about the current URL.
The location object is part of the window object and is accessed through the window.location property.
Note Note: There is no public standard that applies to the location object, but all major browsers support it.

Location Object Properties

PropertyDescription
hashReturns the anchor portion of a URL
hostReturns the hostname and port of a URL
hostnameReturns the hostname of a URL
hrefReturns the entire URL
pathnameReturns the path name of a URL
portReturns the port number the server uses for a URL
protocolReturns the protocol of a URL
searchReturns the query portion of a URL

Location Object Methods

MethodDescription
assign()Loads a new document
reload()Reloads the current document
replace()Replaces the current document with a new one

No comments:

Post a Comment