I am have been reading material on JavaScript and there are two ways of accessing the title
of the page:
window.title
propertydocument.title
propertyBut when applying, the second only works. I am unable to understand why there are two titles and why both of them don't work.
The window is the actual global object. The screen is the screen, it contains properties about the user's display. The document is where the DOM is.
The window title for a page (often called the "title tag") is, most simply, the text that appears at the top of a visitor's web browser when viewing that page.
Related Content. Any written instrument, such as a bill of sale, title deed, bill of lading, that proves ownership or control and possession. A person in possession of a document of title can receive, hold, sell or otherwise dispose of the document and the goods it covers. Resource ID 9-570-7606.
Code used to describe document style. JavaScript. General-purpose scripting language. Protocol for transmitting web resources.
window.document.title
is correct.
window.title
is incorrect, because the window
object doesn't have a title
property (all the properties of window are down the left side, you'll see title
isn't there).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With