Click here to get back home

specifying anchors and cgi parameters in a single URI

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
specifying anchors and cgi parameters in a single URI Crimperman 02-24-2006
Get Chitika Premium
Posted by Crimperman on February 24, 2006, 8:34 am
Please log in for more thread options


Hi,

need some advice on URIs

In a dynamic page (perl driven) we list a number of items presented in
an hierarchical tree structure. Within that page is a form which allows
you to search for items containing various strings (trying to get the
users to *remember* CTRL+F was proving fruitless). The results are then
presented at the top of the page with links to the relative anchor
references (<a href="#foo">) . When clicked these would take you to
that item in the hierarchical tree.

The problem is that the URI of the page itself contains CGI parameters
( e.g. http://www.foo.com/script.cgi?p=1&r=2 ) and these are carried
over to the URIs containing the anchors ( e.g.
http://www.foo.com/script.cgi?p=1&r=2#foo ).

These URIs containing parameters and anchors work in IE (6 and below)
but not in Moziall,Firefox, Konqueror or Opera. Any ideas on what I can
do to enable the same functionality cross-browser?

regards
Crimperman


Posted by mbstevens on February 24, 2006, 9:06 am
Please log in for more thread options


Crimperman wrote:
> Hi,
>
> need some advice on URIs
>
> In a dynamic page (perl driven) we list a number of items presented in
> an hierarchical tree structure. Within that page is a form which allows
> you to search for items containing various strings (trying to get the
> users to *remember* CTRL+F was proving fruitless). The results are then
> presented at the top of the page with links to the relative anchor
> references (<a href="#foo">) . When clicked these would take you to
> that item in the hierarchical tree.
>
> The problem is that the URI of the page itself contains CGI parameters
> ( e.g. http://www.foo.com/script.cgi?p=1&r=2 ) and these are carried
> over to the URIs containing the anchors ( e.g.
> http://www.foo.com/script.cgi?p=1&r=2#foo ).
>
> These URIs containing parameters and anchors work in IE (6 and below)
> but not in Moziall,Firefox, Konqueror or Opera. Any ideas on what I can
> do to enable the same functionality cross-browser?
>
> regards
> Crimperman
>


A number of URI characters must be encoded, one of which is "#".
Use "%23" for it. Google "URI encoding" for more detail.

If you don't know about this already,
you _may_ also have written your script in a way that
crackers can get into easily.

Google for "Perl detainting" and "Perl CGI security" and such.
Be sure to use cgi.pm instead of your own cgi interface -- it
has many security checks built in that you may not have thought
about.
--
mbstevens
http://www.mbstevens.com/


Posted by Crimperman on February 24, 2006, 10:29 am
Please log in for more thread options


mbstevens wrote:

>A number of URI characters must be encoded, one of which is "#".
>Use "%23" for it. Google "URI encoding" for more detail.

This creates two problems. An href of "%23foo" (and *only* that) is not
passed by the browser as a local anchor - it is instead passed as
http://www.foo.com/#foo .
Giving the entire URI in the link to the anchor (
http://www.foo.com/script.cgi?p=1&r=2%23foo ) ends up with the browser
passing 2%23foo as the value for the last parameter.
Encoding the # using &#035; just gives the same result as using a plain
# character.

>If you don't know about this already,
>you _may_ also have written your script in a way that
>crackers can get into easily.

I did know about it (the other relevant characters are encoded) but -
in this case - the script is not on a public facing site and I don't
use this kind of script on any of the public facing ones. Thanks tho'.

Crimperman


Posted by David Dorward on February 24, 2006, 11:18 am
Please log in for more thread options


mbstevens wrote:

> A number of URI characters must be encoded, one of which is "#".
> Use "%23" for it. Google "URI encoding" for more detail.

That is because the # character has special meaning in URLs, so if you want
to pass that character to the server you have to encode it. In this case
the OP *wants* the special meaning, so URL Encoding it would not be the way
to go.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is

Posted by Crimperman on February 24, 2006, 12:08 pm
Please log in for more thread options


Solved.

It turned out the targets were all coded incorrectly. They were all of
the form <a name="#foo"></a> . That is including the hash mark in the
name of the target!

Many thanks for the suggestions though.

Crimperman


Similar ThreadsPosted
Parameters of July 19, 2005, 12:51 pm
writing parameters to a file January 22, 2005, 4:26 pm
Control Browser Parameters with HTML code? August 26, 2005, 9:14 pm
preserve line breaks in applet parameters January 27, 2007, 10:10 pm
How can I change the Applet's parameters with HTML button or link? May 30, 2005, 1:49 am
Anchors! August 26, 2004, 6:37 am
Anchors with name _and_ id? September 13, 2007, 12:36 am
Single file web page October 17, 2006, 5:07 am
Submit a form using anchors? November 8, 2006, 3:53 pm
how to wrap this single long name in a table? April 5, 2006, 10:20 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap