JavaScript » Document » domain

Syntax:
document.domain = "domaininfo"

This property sets or returns the domain name of the server from which the document originated.

This property sets or returns the domain name of the server from which the document originated. This defaults to the domain name of the server that the document was retreived from, but can be changed to a suffix (and only a suffix) of this name. This allows the sharing of script properties, security allowing, between documents delivered from different servers providing they share the same domain suffix.

The way you can alter the domain name property is very limited. For example, if a document was retreived from the URL 'search.devguru.com', you could change the domain property to 'devguru.com' but not 'search.devguru'.

Examples

Code:
document.domain = "devguru.com"     // This example is o.k.

document.domain = "search.devguru"     // This example is not allowed

document.domain = "devguru.net"     // This example is not allowed
Explanation:

These examples relate to a document retreived from the URL 'search.devguru.com'