I'm writing a Javascript driven one-page application where the URL contains a # param eg. (example.com/#foo/bar
) to represent application state (I've considered using various JS frameworks but cannot, due to various reasons).
Sometimes, the hash may have a space (or many spaces) in it. Eg. example.com/#foo/bar bar2
.
- Is this safe?
- Are there any other characters that shouldn't be used in the hash portion?
This question addresses the question of spaces in the URL portion and recommends escaping spaces. But since changing the fragment after the # doesn't result in a new HTTP request, do those rules apply?