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.

Build modern and responsive webpages

Responsive Typography

Build modern and responsive webpages Try Front-end

Responsive web design helps your site maintain its design integrity on a variety of screen sizes, but how does it affect your typography? With this practical book, graphic designers, web designers, and front-end developers alike will learn the nuts and bolts of how to get the best appearance from type without sacrificing performance on any device.

$ Check price
24.9924.99Amazon 4.5 logo(3+ reviews)

More Front-end resources

Aching back from coding all day?

Self-Massage Tool

Aching back from coding all day? Try Back Problems

Relieve spasms, tight muscles, trigger points and pressure points with the Body Back Buddy! This trigger point massage is designed to help you self-message any area of your body - especially those that are hard to reach. Keeping your muscles relaxes and out of contraction is importan in helping to reduce pain and prevent muscle injury.

$ Check price
29.9529.95Amazon 4.5 logo(3,443+ reviews)

More Back Problems resources

Ad