admiral_grinder has asked for the wisdom of the Perl Monks concerning the following question:

I am wondering if there is a undocumented method in CGI that would allow me to find out what the # anchor is in the URL that was just called.

Our application allows a document displayed in HTML to have several sections in it. Sometimes the menus will jump to a section in a document by using the # anchor. What I need to do is store this # anchor in our history and bookmark components so that users can jump right back to the section instead of loading the document and looking for the section.

Replies are listed 'Best First'.
Re: Getting # anchor from URL
by jhourcle (Prior) on Aug 29, 2005 at 15:31 UTC

    Unless something's changed since I've read through the specs, the browser shouldn't be sending this to the server. If you want to send them back to an anchor, you'll need to use javascript or something that works in the browser.

    If you want to send someone back to where they are, you can try telling them to use their browser's back button, or use the javascript command

    history.go(-1)
      I was thinking that it didn't get passed to the server, but I was hoping. Since the URL anchors are being done through XSLT I can add another param on the query string though. I have a lot of places to change to support it though.