Document: URL プロパティ

URLDocument インターフェイスの読み取り専用プロパティで、文書の位置を文字列で返します。

この文書の URL が入った文字列です。

JavaScript

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

HTML

html
<p id="urlText">
  URL:<br />
  <span id="url">URL がここに表示されます</span>
</p>

結果

仕様書

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

ブラウザーの互換性

BCD tables only load in the browser

関連情報