IHTMLEventObj5::domain Property
.gif)
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
HRESULT IHTMLEventObj5::get_domain(BSTR *p); HRESULT IHTMLEventObj5::put_domain(BSTR v);
Parameters
- p
Pointer to a variable of type BSTR that receives the domain name.- v
BSTR that specifies the domain name.
Return Value
Returns S_OK if successful, or an error value otherwise.
Remarks
To see if two documents are in the same domain, compare IHTMLEventObj5::domain with the IHTMLLocation::hostname property.
Example
The following script checks the IHTMLEventObj5::domain property to determine if the sender of an HTMLWindowEvents3::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 } });
See Also