HtmlDocument.Domain Property


Gets or sets the string describing the domain of this document for security purposes.

 property System::String ^ Domain { System::String ^ get(); void set(System::String ^ value); };
public string Domain { get; set; }
member this.Domain : string with get, set
Public Property Domain As String

Property Value


A valid domain.


The argument for the Domain property must be a valid domain name using Domain Name System (DNS) conventions.


By default, two Web pages in different frames are prevented from accessing each other's content using script; even and are, in this instance, considered different domains. To enable cross-frame scripting for pages from the same top-level domain, you can assign a new value to the Domain property. In the previous URL example, setting Domain to would allow both pages to communicate with one another.

Strings assigned to the Domain property must be valid top-level domains. In the previous URL example, you can set Domain to, but not to .com, which would enable any page on the Internet to script a page's contents.

You cannot use the Domain property to enable cross-frame scripting for pages accessed using two different protocols. If one frame in your page comes from a Web server (the http:// protocol) and another comes from the file system (the file://) protocol, they will not be able to communicate with one another regardless of the value of the Domain property.

Applies to

See also