Document.documentURI

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

構文

js
const uri = document.documentURI;

JavaScript

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

HTML

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

関連情報