MDN self-hosted library · e01.org

HTMLAnchorElement: attributionSrc property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
  aElem.attributionSrc =
    "https://a.example/register-source https://b.example/register-source";
html
<a href="https://shop.example"> Click to visit our shop </a>
js
const aElem = document.querySelector("a");
aElem.attributionSrc = "";
html
<a href="https://ourshop.example"> Click to visit our shop </a>
js
// encode the URLs in case they contain special characters
// such as '=' that would be improperly parsed.
const encodedUrlA = encodeURIComponent("https://a.example/register-source");
const encodedUrlB = encodeURIComponent("https://b.example/register-source");

const aElem = document.querySelector("a");
aElem.attributionSrc = `${encodedUrlA} ${encodedUrlB}`;