A Link that makes its target ‘part of’ the document.

Hierarchy

Properties

target: string

The link’s target URL.

This is the exact value as it appears in the document, and may thus be a relative URL. For most use cases absoluteTarget is more useful than target.

This property can be written to, which will modify the resource containing the link.

absoluteTarget?: `${string}:${string}`

The link’s target URL as an absolute URL.

This takes into account factors like the <base href="..."> element.

If the target is not a valid (relative) URL, absoluteTarget equals undefined.

from: Anchor

Information about where the link points ‘from’ (the place where it is defined) in the DOM or stylesheet.

isSubresource: true

A boolean indicating whether the resource being linked to is normally considered a subresource of the document. For example, the src of an <img> element specifies a subresource because the image is considered part of the document, while the href of an <a> or the action of a <form> merely point to another resource.

subresourceType?: SubresourceType

Indicates the type of resource (image, style, ...). This corresponds to what is now called the ‘destination’ in the WHATWG fetch spec.

resource?: Resource

If the subresource is available, it can be assigned to this attribute.