文档:URL 属性
Document 接口的只读属性 URL 以字符串形式返回文档位置。
值
包含文档 URL 的字符串。
示例
JavaScript
js
document.getElementById("url").textContent = document.URL;
HTML
html
<p id="urlText">
URL:<br />
<span id="url">URL goes here</span>
</p>
结果
规范
| 规范 |
|---|
| DOM # ref-for-dom-document-url① |
浏览器兼容性
加载中…
另见
document.documentURI属性返回相同的值。