url.origin


版本历史
版本变更
v15.0.0

方案 "gopher" 不再特殊,url.origin 现在为其返回 'null'

获取网址的源的只读的序列化。

\Gets the read-only serialization of the URL's origin.

const myURL = new URL('https://example.org/foo/bar?baz');
console.log(myURL.origin);
// Prints https://example.org 
const idnURL = new URL('https://測試');
console.log(idnURL.origin);
// Prints https://xn--g6w251d
console.log(idnURL.hostname);
// Prints xn--g6w251d 

AltStyle によって変換されたページ (->オリジナル) /