Share via


domain Property

New for Windows Internet Explorer 8

Note: This documentation is preliminary and is subject to change.

Sets or retrieves the fully qualified domain name of the document that fired the event.

Syntax

[ sDomain = ] event.domain [ = sDomain ]

Possible Values

sDomain String that specifies or receives the domain name.

The property is read/write. The property has no default value.

Remarks

To see if two documents are in the same domain, compare domain with the location.hostname property.

Example

The following script checks the domain property to determine if the sender of an onmessage is in the same domain.

document.attachEvent('onmessage',function(e) {
    if (e.domain == location.hostname) {
        e.source.postMessage(e.data);
    }
    else {
        // cross-domain message
    }
}); 

Standards Information

This property is defined in HTML 5 World Wide Web link.

Applies To

event

See Also

origin