Skip to main content
URL.prototype.origin - node__url.d.ts - Node documentation
property URL.prototype.origin

Usage in Deno

```typescript import { URL } from "node:node__url.d.ts"; ```
Gets the read-only serialization of the URL's origin. ```js const myURL = new URL('https://example.org/foo/bar?baz'); console.log(myURL.origin); // Prints https://example.org ``` ```js const idnURL = new URL('https://測試'); console.log(idnURL.origin); // Prints https://xn--g6w251d console.log(idnURL.hostname); // Prints xn--g6w251d ```

Type

string