How do I get URL label when parsing request URL?

前端 未结 1 678
不思量自难忘°
不思量自难忘° 2020-12-20 17:21

URL can have a label, separated with a \"#\" sign, coming after the URL parameters. E.g. http://example.com/foo/bar.jsp?p1=v1#test_label

I would expect label to be p

相关标签:
1条回答
  • 2020-12-20 18:08

    I think the HTTP spec decided that "anchors" (Is that what they're called? Anyway, the hash sign and the label that comes after) don't get passed to the server, they're just used client-side to scroll the page, or to be used in JavaScript. So there's no way you can get that value, other than having a little script passing it to your server with an Ajax request once the page is loaded, but that's not very convenient.

    0 讨论(0)
提交回复
热议问题