A hash value has a limited set of characters that are technically permitted for it. If you look at the spec URL here, the hash value is called fragmented. Here is a grammar for what it may contain:
fragmentid xalphas
xalphas xalpha [xalphas]
xalpha alpha | digit | safe | extra | escape
safe $ | - | _ | @ | . | & | + | -
extra! | * | "| '| (|) |,
escape% hex hex
alpha a | b | c | d | e | f | g | h | i | j | k |
l | m | n | o | p | q | r | s | t | u | v |
w | x | y | z | A | B | C | D | E | F | G |
H | I | J | K | L | M | N | O | P | Q | R |
S | T | U | V | W | X | Y | Z
digit 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
You will notice that you can have & , but not = , if you do not call encodeURIComponent and decodeURIComponent with a hash value when setting or retrieving it.
As for which method to use, it really is up to you. You can make your own little syntax in a hash value if you need to provide several parameters there. I personally would probably separate the values with & exact same way as in the query string, but instead of = use - .
source share