domain
Description
The domain of Document for JS returns the current domain used for security checks.
Can be set to a value that removes subdomains, to change the origin's domain to allow pages on other subdomains of the same domain (if they do the same thing) to access each other. This enables pages on different hosts of a domain to synchronously access each other's DOMs.
In sandboxed iframes, Documents with opaque origins, and Documents without a browsing context, the setter will throw a "SecurityError" exception. In cases where crossOriginIsolated or originAgentCluster return true, the setter will do nothing.
Syntax
document.domain [ = domain ]
Examples
1 · get
2 · set
Links
Document
- adoptNode
- body
- characterSet
- close
- compatMode
- contentType
- cookie
- createCDATASection
- createComment
- createDocumentFragment
- createElement
- createElementNS
- createProcessingInstruction
- createTextNode
- currentScript
- defaultView
- designMode
- dir
- doctype
- Document
- documentElement
- documentURI
- embeds
- exitPictureInPicture
- forms
- getElementsByClassName
- getElementsByName
- getElementsByTagName
- getElementsByTagNameNS
- hasFocus
- head
- hidden
- images
- implementation
- importNode
- lastModified
- links
- location
- onreadystatechange
- onvisibilitychange
- open
- parseHTMLUnsafe
- pictureInPictureEnabled
- plugins
- readyState
- referrer
- scripts
- title
- URL
- visibilityState
- write
- writeln