Skip to content

URL: hash property percent encoding #37165

@bsmth

Description

@bsmth

MDN URL

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

What specific section or headline is this issue about?

Main section

What information was incorrect, unhelpful, or incomplete?

The fragment is not percent-encoded.

This is not true.

What did you expect to see?

The fragment is percent-encoded plus some examples like:

const url = new URL(
  "https://developer.mozilla.org/en-US/docs/Web/API/URL/href#example one",
);
console.log(url.hash); // '#example%20one'

The original spoke about percent decoding, hard to know what the motivation was, but possibly:

const url = new URL(
  "https://developer.mozilla.org/en-US/docs/Web/API/URL/href#example%20one",
);
console.log(url.hash); // NOT '#example one'?
console.log(url.hash); // '#example%20one'

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