Affecting URLUtils.hash no longer decodes fragment

Published: | Categories: DOM | Creative Commons BY-SA 3.0


The URLUtils.hash property, which is available as location.hash, HTMLAnchorElement.hash, URL.hash, etc., now returns a percent-encoded fragment as we see in the href property, to follow the latest specification. So, for instance, a space will be %20, and you have to use the decodeURIComponent method to get the decoded fragment (example). This change was originally planned for Firefox 38 but has been postponed due to compatibility issues. This new behaviour matches the current version of Safari.