Document.URL
Document
インターフェイスの URL
プロパティは読取専用で、文書の位置を文字列で返します。
構文
js
const url = document.URL;
例
JavaScript
js
document.getElementById("url").textContent = document.URL;
HTML
html
<p id="urlText">
URL:<br />
<span id="url">URL goes here</span>
</p>
結果
仕様書
Specification |
---|
DOM Standard # ref-for-dom-document-url① |
ブラウザーの互換性
BCD tables only load in the browser
関連情報
- 同じ値を返す
document.documentURI
プロパティ