Browsers like Firefox display URLs containing spaces (including nbsp's) with an actual space (); Chrome always displays spaces as
%20
(and nbsp's as %C2%A0
) in the address bar. (ie, Firefox displays http://example.com/A B
in the address bar while Chrome displays http://example.com/A%20B
.) Is there any way to make Chrome display spaces as instead of
%20
?
-
I'd like to have configuration for that too <3– BetlistaJan 30, 2020 at 10:45
1 Answer
If you can do with underscores instead of spaces (like in my case, where I only need to improve the readability of the URL), you can use:
window.history.pushState("string", "Title", window.location.href.replace(new URL(window.location.href, location).origin+'/', '').replaceAll('%20','_'))
(the last replaceAll
could be an space instead of an underscore but Chrome would replace it with %20 anyway)
Maybe this could be done better with a Chrome extension.