HTML and CSS Reference
In-Depth Information
for the element, which will look like a snippet of HTML source code. This beha-
vior doesn't help you discover the properties that a referenced HTML element has,
so in cases like this, use the console method
console.dir()
instead of
con-
sole.log()
. This method will show you the properties of a particular object sent to
it.
Other objects of note in the
window
object include the following:
• The
navigator
object contains information about the web browser being
used such as the plug-ins installed and vendor and version information. Also
contained in this object is geolocation information.
• The
screen
object contains information about the dimensions, color depth,
and related information about the display being used to view the current web
page.
• The
history
object contains methods for accessing the browser's forward and
back buttons and related functionality programmatically.
• The
location
object contains information about the web page URL address.
The website can be redirected by setting the
href
property in this object, such
• The
document
object contains the DOM representation of all the HTML ele-
ments on the web page currently being viewed.
Some information will be buried; for instance, you may not immediately find the
alert()
method that was used earlier. For this we need to look at the prototype used
to create the
window
object, which is accessible through the following:
…
console.log(window.constructor.prototype);
// log the
window object's prototype.
…
Search WWH ::
Custom Search