How to escape the #
hash sign (sometimes known as number sign or pound sign) sent in the query string of a URL?
Add a comment
|
1 Answer
Percent encoding. Replace the hash with %23
.
-
-
5This doesn't work on Chrome 74. Furthermore,
encodeURI('#');
is returning#
and not the percent encoded character May 20, 2019 at 12:10 -
23
#
is a valid URI character, but it starts the hash fragment, so you need to encode it in the query string. CompareencodeURIComponent('#')
. What do you see in Chrome 74? May 21, 2019 at 14:48