MDN self-hosted library · e01.org

Document: documentURI property

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

html
<p id="urlText">
  URL:<br />
  <span id="url">URL goes here</span>
</p>
js
document.getElementById("url").textContent = document.documentURI;