Web/API/HTMLBodyElement

From Get docs


The HTMLBodyElement interface provides special properties (beyond those inherited from the regular HTMLElement interface) for manipulating <body> elements.

Properties

Inherits properties from its parent, HTMLElement and from WindowEventHandlers.

HTMLBodyElement.aLink '
Is a DOMString that represents the color of active hyperlinks.
HTMLBodyElement.background '
Is a DOMString that represents the description of the location of the background image resource. Note that this is not an URI, though some older version of some browsers do expect it.
HTMLBodyElement.bgColor '
Is a DOMString that represents the background color for the document.
HTMLBodyElement.link '
Is a DOMString that represents the color of unvisited links.
HTMLBodyElement.text '
Is a DOMString that represents the foreground color of text.
HTMLBodyElement.vLink '
Is a DOMString that represents the color of visited links.

Methods

No specific methods; inherits methods from its parent, HTMLElement, and from WindowEventHandlers.

Event handlers

No specific event handlers; inherits event handlers from its parent, HTMLElement and from WindowEventHandlers.

WindowEventHandlers.onafterprint
Is an EventHandler representing the code to be called when the afterprint event is raised.
WindowEventHandlers.onbeforeprint
Is an EventHandler representing the code to be called when the beforeprint event is raised.
WindowEventHandlers.onbeforeunload
Is an EventHandler representing the code to be called when the beforeunload event is raised.
WindowEventHandlers.onhashchange
Is an EventHandler representing the code to be called when the hashchange event is raised.
WindowEventHandlers.onlanguagechange '
Is an EventHandler representing the code to be called when the languagechange event is raised.
WindowEventHandlers.onmessage
Is an EventHandler called whenever an object receives a message event.
WindowEventHandlers.onmessageerror
Is an eventHandler called whenever an object receives a messageerror event.
WindowEventHandlers.onoffline
Is an EventHandler representing the code to be called when the offline event is raised.
WindowEventHandlers.ononline
Is an EventHandler representing the code to be called when the online event is raised.
WindowEventHandlers.onpagehide
Is an EventHandler representing the code to be called when the pagehide event is raised.
WindowEventHandlers.onpageshow
Is an EventHandler representing the code to be called when the pageshow event is raised.
WindowEventHandlers.onpopstate
Is an EventHandler representing the code to be called when the popstate event is raised.
WindowEventHandlers.onrejectionhandled
An EventHandler representing the code executed when the rejectionhandled event is raised, indicating that a Promise was rejected and the rejection has been handled.
GlobalEventHandlers.onresize
Is an EventHandler representing the code to be called when the resize event is raised.
WindowEventHandlers.onstorage
Is an EventHandler representing the code to be called when the storage event is raised.
WindowEventHandlers.onunhandledrejection
An EventHandler representing the code executed when the unhandledrejection event is raised, indicating that a Promise was rejected but the rejection was not handled.
WindowEventHandlers.onunload
Is an EventHandler representing the code to be called when the unload event is raised.

Specifications

Specification Status Comment
HTML Living StandardThe definition of 'HTMLBodyElement' in that specification. Living Standard Technically, the event-related properties onafterprint, onbeforeprint, onbeforeunload, onblur, onerror, onfocus, onhashchange, onlanguagechange, onload, onmessage, onoffline, ononline, onpopstate, onresize, onstorage, and onunload, have been moved to WindowEventHandlers. HTMLBodyElement implements this interface.
HTML 5.1The definition of 'HTMLBodyElement' in that specification. Recommendation
HTML5The definition of 'HTMLBodyElement' in that specification. Recommendation The following properties are now obsolete: aLink, bgColor, background, link, text, and vLink.

The following properties have been added: onafterprint, onbeforeprint, onbeforeunload, onblur, onerror, onfocus, onhashchange, onload, onmessage, onoffline, ononline, onpopstate, onresize, onstorage, and onunload.

Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTMLBodyElement' in that specification. Obsolete No change from Document Object Model (DOM) Level 1 Specification.
Document Object Model (DOM) Level 1 SpecificationThe definition of 'HTMLBodyElement' in that specification. Obsolete Initial definition.

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
HTMLBodyElement Chrome

Full support 1

Edge

Full support 12

Firefox

Full support 1

IE

Full support 4

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 4

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

aLink

Deprecated'

Chrome

Full support 1

Edge

Full support 12

Firefox

Full support 1

IE

Full support 4

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 4

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

background

Deprecated'

Chrome

Full support 1

Edge

Full support 12

Firefox

Full support 1

IE

Full support 4

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 4

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

bgColor

Deprecated'

Chrome

Full support 1

Edge

Full support 12

Firefox

Full support 1

IE

Full support 4

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 4

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

link

Deprecated'

Chrome

Full support 1

Edge

Full support 12

Firefox

Full support 1

IE

Full support 4

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 4

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

text

Deprecated'

Chrome

Full support 1

Edge

Full support 12

Firefox

Full support 1

IE

Full support 4

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 4

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

vLink

Deprecated'

Chrome

Full support 1

Edge

Full support 12

Firefox

Full support 1

IE

Full support 4

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 4

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

Legend

Full support  
Full support
Deprecated. Not for use in new websites.'
Deprecated. Not for use in new websites.


See also