TOC PREV NEXT INDEX

domref



domain


domain gets/sets the domain of the current document.

Syntax

domain_name = document.domain
 
document.domain = domain_name
 

Parameters

domain_name is a string referring to the domain of the current document.

Example

bad_domain = "www.love.com";
 
if ( document.domain == bad_domain ) {
 
   window.close();
 
}
 
// for document www.love.com/good.html, 
 
// this script closes the window
 

Notes

This property returns NULL if the server of the document cannot be identified. In the DOM spec, this property is listed as being read-only, but Mozilla lets you set it.

Specification

domain
 


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT INDEX