Skip to content

Mention URL.href adds a trailing slash if pathname is empty #43017

@aruna-evan

Description

@aruna-evan

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/URL/href

What specific section or headline is this issue about?

console.log of url.href needs a trailing /

What information was incorrect, unhelpful, or incomplete?

In the example:

const url = new URL(
  "https://developer.mozilla.org/en-US/docs/Web/API/URL/href",
);
console.log(url.href); // Logs: 'https://developer.mozilla.org/en-US/docs/Web/API/URL/href'

the logs of url.href should include a trailing /.

What did you expect to see?

This is what actually happens:

Image

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

MDN metadata

Page report details

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions