SPUG: Trapping Named Anchor References
brian at tangent.org
Mon Oct 9 15:03:11 CDT 2000
ced at carios2.ca.boeing.com wrote:
> > > I need to capture a named anchor reference for a redirect.
> > Story line:
> > A user clicks on a saved link or a link in an email like:
> > http://www.myserver.com/cgi/coolsite.pl?page=124#item16
> > but the coolsite.pl script notices the user doesn't have a logged-in cookie so
> > it displays a log-in page rather than the requested content page. Fine so far.
> > The user fills in UserID and Password and clicks on Submit. The form action
> > specifies the log-in script which verifies the users info and then does a
> > re-direct to the url the user originally wanted to see (which still appears in
> > its entirety in the browser Location box) to be displayed by the normal display
> > script.
> > Everything works fine except the named anchor reference.
> > Here's the problem: I can find no way to trap the '#item16' portion of the url.
> > I need that in order to compose the complete URL for the 'Location:' header so
> > the user does not end up confused to find themselves at the top of a long page
> > when they really want to see an item farther down.
> > On Linux/Apache, the anchor ref does not appear anywhere in %ENV
> > You can check this at:
> > http://caucus.bigmindmedia.com/cgi-dv/showenv.pl?data=123#AnchorRef
Assuming mod_perl (and I understand what you are asking for)
my $r = Apache->request;
my $string = $r->the_request();
That will give you all the info that you need.
You may also want to look into what parsed_uri() returns
when called from $r.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
More information about the spug-list