Multiple hash signs in URL

后端 未结 3 1363
醉酒成梦
醉酒成梦 2021-01-01 16:08

Or maybe you call it \"sharp\" - the # symbol.

I\'ve came across one instance, where #! and # used simultaneously in a single URL. From reading other articles, inclu

3条回答
  •  臣服心动
    2021-01-01 16:43

    The format for a fragment only allows slashes, question marks, and pchars. If you look up the RFC, you'll see that the hash mark is not a valid pchar.

    However, browsers will try their best to read non-valid URLs by treating repeat hashes as though they are escaped, as you can see by checking the value of window.location.hash (in IE, Firefox, and Chrome) for

    http://www.example.com/hey#foo#bar
    

    which is the same window.location.hash for

    http://www.example.com/hey#foo%23bar
    

提交回复
热议问题