demo · v130

Non-special scheme URL parser

Type or pick a URL with a non-special scheme. The browser's URL constructor now parses authority, host, and port for schemes like git, ipfs, web+pkg instead of treating everything after the scheme as an opaque path.

the code

// v130 — non-special schemes parse properly:
const u = new URL("git+ssh://user@host:2222/repo.git");
u.protocol;  // "git+ssh:"
u.username;  // "user"
u.host;      // "host:2222"
u.port;      // "2222"
u.pathname;  // "/repo.git"

// Pre-v130 (and other engines): u.host would be "" and the whole
// "user@host:2222/repo.git" was stuffed into pathname.

see also