THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

HTML domain Property

Document Object Reference Document Object

Example

Get the domain name of the server that loaded the document:

var x = document.domain;

The result of x will be:

www.w3schools.com
Try it yourself »

Definition and Usage

The domain property returns the domain name of the server that loaded the current document.


Browser Support

Property
domain Yes Yes Yes Yes Yes

Syntax

document.domain

Technical Details

Return Value: A String, representing the domain name of the server that loaded the current document, or null if the domain of the document cannot be identified
DOM Version Core Level 2 Document Object

Document Object Reference Document Object