• Set the link’s target to a new URL.

    Essentially this performs link.target = target, but with extra steps:

    • If the link is defined by an attribute of an HTML element, the element’s integrity attribute (if any) is removed. (In case the new target has different content, the integrity attribute could prevent it from being loaded.)
    • If the link is defined by an attribute of an HTML element, and config.rememberOriginalUrls is true, the attribute’s existing value is preserved in a data-original-… attribute.

    Note that modifying a Link’s target updates the Resource that contains the link.

    Parameters

    • link: Link

      The link to modify.

    • target: string

      The link’s new target: a relative or absolute URL.

    • config: { rememberOriginalUrls?: boolean } = {}
      • Optional rememberOriginalUrls?: boolean

        If true, and the link is defined by an attribute of an HTML element, the attribute’s existing value is preserved in a data-original-… attribute.

    Returns void