03. Other BOM elements history, location, navigator, screen

There are a handful of other Browser Object Models that we will briefly go over here.

Screen

The window.screen object obtains information about the user's screen.

availHeight, availWidth
Width and height of the available screen (excluding taskbars).
height, width
Width and height of the available screen (with taskbars).
colorDepth
Number representing the bit depth of the color palette on user's screen.

Navigator

The window.navigator object is used to query a number of elements about the visitor's browser and environment.

language
Determine language of browser.
appName
Check name of browser.
geolocation
Returns geolocation object used to locate user's position.
onLine
Determines if user is online.
platform
Which platform user is using (OS X, Windows, Linux).
cookieEnabled
Determines whether cookies are enabled.
javaEnabled()
Check if user's Java is enabled.

Location

The window.location object provides information about the current URL.

hash
Returns anchor part of a URL.
host
Returns hostname and port number of URL.
pathname, port
Returns path or nort number of URL.
hostname
Returns hostname of a URL.
origin
Returns protocol, hostname and portname of a URL.
assign()
Loads new document.
reload()
Reload current document.
replace()
Replace current document.

History

The window.history gives you information regarding the user's history. Due to security concerns, we can't directly access which URL's our users have visited, but we may find other parameters.

length
Return the length of the user's history.
back(), forward()
Move the user forward or back a page.
go()
Loads specific URL from history list.

Aching back from coding all day?

Foam Seat Cushion

Aching back from coding all day? Try Back Problems

This foam seat cushion relieves lowerback pain, numbness and pressure sores by promoting healthy weight distribution, posture and spine alignment. Furthermore, it reduces pressure on the tailbone and hip bones while sitting. Perfect for sitting on the computer desk for long periods of time.

$ Check price
99.9599.95Amazon 4.5 logo(9,445+ reviews)

More Back Problems resources

Build modern and responsive webpages

JavaScript & JQuery

Build modern and responsive webpages Try Front-end

This book was written for anyone who wants to use JavaScript to make their websites a little more interesting, engaging, interactive, or usable. In particular, it is aimed at people who do not have a degree in computer science (well, not yet anyway).

$ Check price
39.9939.99Amazon 4.5 logo(385+ reviews)

More Front-end resources

Ad