Retain url hash value using Request.UrlReferrer
I have an list of paged results that is using AJAX requests to populate next/previous page clicks. I am using the jQuery history plugin to keep track of the page # the user is on. This b开发者_运维百科asically appends http://site.com?query#pg=5 to the url.
If I click through to another page, I am trying to implement a Go Back button in the breadcrumb control. In trying to use:
Request.UrlReferrer
it seems that this does not preserve the # value at all. Is this possible?
The browser is responsible for setting the HTTP_REFERER header and sending that to the server. There has been research done for other questions on Stack Overflow (e.g. this one) and it appears that none of the modern browsers send the hash value.
All is not lost, however. A colleague of mine was faced with a similar situation and ended up setting up an AJAX call to the server to track the hash values on the server as well as the client. It's a bit hack-y, but you can make it work.
精彩评论