开发者

When using chrome/chromium, brackets in url's hash is shown as %5Bwhatever%5D. Using firefox [whatever]. There is any way to fix it?

开发者 https://www.devze.com 2023-01-25 00:09 出处:网络
I\'s using jQuery 1.4.3 and the BBQ plugin to handle history and hash. When I update the hash with that string

I's using jQuery 1.4.3 and the BBQ plugin to handle history and hash.

When I update the hash with that string "listing=restaurants&search[province]=1&search[main_food]=2" the url bar shows "listing=restaurants&search%5Bprovince%5D=1&search%5Bmain_food%5D=2"

Ugly.

There is any way to show i开发者_运维问答t nice, like firefox does?

Thanks


The characters [ and ] must not appear literally in the fragment of a URI. Here’s the corresponding ABNF for URI (RFC 3986):

fragment      = *( pchar / "/" / "?" )
pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
pct-encoded   = "%" HEXDIG HEXDIG
sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
              / "*" / "+" / "," / ";" / "="

Any character that is not listed her must be encoded using the percent-encoding. So Chrome’s behavior is correct. But I guess Firefox is just displaying the characters that are represented by %5B and %5D. And that’s up to the browser.

0

精彩评论

暂无评论...
验证码 换一张
取 消