deno.com
property URL.origin

The origin property of the URL interface is a string that represents the origin of the URL, that is the URL.protocol, URL.host, and URL.port.

Examples #

#
const myURL = new URL('https://foo.example.org/bar');
console.log(myURL.origin);  // Logs "https://foo.example.org"
#
const myURL = new URL('https://example.org:8080/foo');
console.log(myURL.origin);  // Logs "https://example.org:8080"

Type #

string

See #