Re: [whatwg/url] Support relative URLs (#531)

To me, a relative URL is any URL that doesn't have a scheme, such as `/page.html` and `//site.com/page.html`. In the wild, I've seen people refer to `/page.html` as an "absolute URL", but that doesn't make sense to me, except perhaps from the server's perspective.

I didn't mean to imply that you can `fetch()` relative URLs in Node or Deno. That generally wouldn't work. (Well, to be precise, in Deno you can actually opt-in to providing a value for `window.location` on the command line with the `--location` option. Then you could use `fetch()` with a relative URL.)

Rather, the problem is the combination of the following:
1. We want to parse and manipulate URLs, thus we use `new URL()`
2. The API design of `new URL()` forces us to use browser and DOM APIs to explicitly provide an absolute base URL, instead of leaving the base URL _implicit_ as is done in every other web API that I'm familiar with, including `fetch()`
3. The usage of those browser and DOM APIs makes it surprisingly difficult to write cross-platform (isomorphic) code, which is problematic for many use cases, such as an HTTP request library

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/531#issuecomment-836836953

Received on Monday, 10 May 2021 15:26:17 UTC