HTML:標記語言
CSS:樣式語言
JavaScript:指令碼語言
Web API:程式設計介面
所有 Web 技術
學習 Web 開發
發現我們的工具
更好地瞭解 MDN
此功能已相當成熟,可在多種裝置和瀏覽器版本上使用。自 2016 年 7 月起,所有瀏覽器均已支援此功能。
toString() 方法是 Location 介面的字串化方法,它返回一個包含完整 URL 的字串。它是 Location.href 的只讀版本。
toString()
Location
Location.href
無。
一個表示物件 URL 的字串。
// Let's imagine this code is executed on https://example.com/path?search#hash const result = window.location.toString(); // Returns: 'https://example.com/path?search#hash'
載入中…