Document.documentURI

Document インターフェイスの documentURI プロパティは、文書の位置を文字列で返します。

構文

const uri = document.documentURI

JavaScript

document.getElementById("url").textContent = document.documentURI;

HTML

<p id="urlText">
  URL:<br/>
  <span id="url">URL goes here</span>
</p>

結果

仕様書

Specification
DOM Standard
# ref-for-dom-document-documenturi①

ブラウザーの互換性

BCD tables only load in the browser

関連情報