scriptElem.attributionSrc =
"https://a.example/register-source https://b.example/register-source";HTMLScriptElement: attributionSrc property / notebook
HTMLScriptElement: attributionSrc property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
<script src="advertising-script.js"></script>const scriptElem = document.querySelector("script");
scriptElem.attributionSrc = "";<script src="advertising-script.js"></script>// 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 scriptElem = document.querySelector("script");
scriptElem.attributionSrc = `${encodedUrlA} ${encodedUrlB}`;