Uredi

Deli z drugimi prek


HtmlDocument.Domain Property

Definition

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

public:
 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.

Exceptions

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

Remarks

By default, two Web pages in different frames are prevented from accessing each other's content using script; even www.microsoft.com and learn.microsoft.com 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 microsoft.com 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 microsoft.com, 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