現在の文書の URL を文字列で返します。
Document
インターフェイスの URL
は読み取り専用のプロパティです。
構文
var string = document.URL;
例
JavaScript
document.getElementById("url").textContent = document.URL;
HTML
<p id="urlText"> URL:<br/> <span id="url">URL goes here</span> </p>
Result
仕様
仕様 | 策定状況 | 備考 |
---|---|---|
HTML Living Standard Document.URL の定義 |
現行の標準 | プロパティは DOMString の代わりに USVString と定義されています。 |
Document Object Model (DOM) Level 1 Specification Document.URL の定義 |
廃止された | 初期定義 |
ブラウザ実装状況
We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
基本サポート | (有) | (有) | (有) | (有) | (有) | (有) |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
基本サポート | (有) | (有) | (有) | (有) | (有) | (有) |