Href to the current page

Discussion in 'HTML' started by toufik toufik, Jul 12, 2004.

  1. I like to make a link in a web page to the page itself,
    I've tried <a href=".">, but it open the directory.

    Thanks for any help.
     
    toufik toufik, Jul 12, 2004
    #1
    1. Advertising

  2. toufik toufik

    Webcastmaker Guest

    In article <8gBIc.5867$>,
    says...
    > I like to make a link in a web page to the page itself,
    > I've tried <a href=".">, but it open the directory.


    Why not just have the href point to the page?

    For example in a page named mypage.html why not have <a
    href="mypage.html">Mypage</a>

    Not sure what you are "really" trying to do, but that will accomplish
    your request.

    --
    WebcastMaker
    The easiest and most affordable way to create
    Web casts, or put presentations on the Web.
    www.webentations.com
     
    Webcastmaker, Jul 12, 2004
    #2
    1. Advertising

  3. toufik toufik

    Dylan Parry Guest

    toufik toufik wrote:

    > I like to make a link in a web page to the page itself,


    For what purpose?

    --
    Dylan Parry
    http://www.webpageworkshop.co.uk - FREE Web tutorials and references

    Now playing: Yes - The Gates Of Delirium [live][Symphonic Tour]
     
    Dylan Parry, Jul 12, 2004
    #3
  4. toufik toufik wrote:

    > I like to make a link in a web page to the page itself,


    Whatever for? The user is already at the current page by the time they can
    activate the link.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Jul 12, 2004
    #4
  5. Thanks friends, I need this in a function that return an html text, I use it
    in many area so it will be simple If I find something like "THIS" or "ME"...




    "toufik toufik" <> wrote in message
    news:8gBIc.5867$...
    > I like to make a link in a web page to the page itself,
    > I've tried <a href=".">, but it open the directory.
    >
    > Thanks for any help.
    >
    >
     
    toufik toufik, Jul 12, 2004
    #5
  6. Dylan Parry <> wrote:

    >> I like to make a link in a web page to the page itself,

    >
    > For what purpose?


    That's what I wonder too, but anyway it is technically possible to do so
    in several ways. The way to do it magically, without hard-coding the
    page's URL onto the page itself, is to use
    href="#"
    By URL specifications, "#" is a reference to the start of the current
    document.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Jul 12, 2004
    #6
  7. toufik toufik

    Augustus Guest

    "toufik toufik" <> wrote in message
    news:8gBIc.5867$...
    > I like to make a link in a web page to the page itself,
    > I've tried <a href=".">, but it open the directory.


    You could use:
    <a href='#'>This Page</a>

    But no guarantee that it works in every browser (I don't know if it does or
    does not work in every browser... I had to do the same thing a year ago and
    was using <a href='#'> and somebody said it might not work in every browser)

    Best thing to do would be to use server side scripting to identify the
    current page and then insert that in the HREF tag

    In ASP it would be:
    <a href='<%=request.serverVariables("script_name")%>'>This Page</a>

    I'd presume every scripting language has something similar
     
    Augustus, Jul 12, 2004
    #7
  8. toufik toufik

    Kris Guest

    In article <Xns9524EAD809FBBjkorpelacstutfi@193.229.0.31>,
    "Jukka K. Korpela" <> wrote:

    > By URL specifications, "#" is a reference to the start of the current
    > document.


    Is it? I remember in another thread very recently (sorry I cannot come
    up with a ref to back that up) it was brought up that the behaviour of a
    an empty fragment identifier is unspecified and hence unpredictable.

    --
    Kris
    <> (nl)
     
    Kris, Jul 12, 2004
    #8
  9. toufik toufik

    Dylan Parry Guest

    Kris wrote:

    >> By URL specifications, "#" is a reference to the start of the current
    >> document.

    >
    > Is it?


    Like Jukka says, "specifications". As we all know, not all browsers are
    written to the standards, and as such the behaviour is unpredictable.

    --
    Dylan Parry
    http://www.webpageworkshop.co.uk - FREE Web tutorials and references

    Now playing: Yes - The Revealing Science of God - Dance of the Dawn
     
    Dylan Parry, Jul 12, 2004
    #9
  10. toufik toufik

    SpaceGirl Guest

    Augustus wrote:

    > "toufik toufik" <> wrote in message
    > news:8gBIc.5867$...
    >
    >>I like to make a link in a web page to the page itself,
    >>I've tried <a href=".">, but it open the directory.

    >
    >
    > You could use:
    > <a href='#'>This Page</a>
    >
    > But no guarantee that it works in every browser (I don't know if it does or
    > does not work in every browser... I had to do the same thing a year ago and
    > was using <a href='#'> and somebody said it might not work in every browser)
    >
    > Best thing to do would be to use server side scripting to identify the
    > current page and then insert that in the HREF tag
    >
    > In ASP it would be:
    > <a href='<%=request.serverVariables("script_name")%>'>This Page</a>
    >
    > I'd presume every scripting language has something similar
    >
    >


    Two people have said that, but I've yet to find a browser that people
    are actually using that doesn't support it. IE, Mozilla, Netscape, Opera
    - all versions, all platforms support it. Perhaps in an accessiblity
    thing? Too tired to go checkin', sorry. If it's not that, then it's not
    worth worrying about. # is just fine.

    --


    x theSpaceGirl (miranda)

    # lead designer @ http://www.dhnewmedia.com #
    # remove NO SPAM to email, or use form on website #
     
    SpaceGirl, Jul 12, 2004
    #10
  11. Jukka K. Korpela, Jul 12, 2004
    #11
  12. toufik toufik

    Kris Guest

    In article <>,
    Dylan Parry <> wrote:

    > >> By URL specifications, "#" is a reference to the start of the current
    > >> document.

    > >
    > > Is it?

    >
    > Like Jukka says, "specifications". As we all know, not all browsers are
    > written to the standards, and as such the behaviour is unpredictable.


    No. I really recall someone drumming up a specification that says that
    there has to be a (non whitespace) character after the # character.

    --
    Kris
    <> (nl)
     
    Kris, Jul 12, 2004
    #12
  13. "toufik toufik" <> wrote:

    > Thanks friends, I need this in a function that return an html text, I
    > use it in many area so it will be simple If I find something like
    > "THIS" or "ME"...


    This does not explain anything. There are no functions in HTML, and you
    haven't told us what you are really trying to achieve. Posting the URL of
    your current design is probably necessary but not sufficient for getting
    a useful answer.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Jul 12, 2004
    #13
  14. I've tried #, it works in IExplorer.
    For the moment it does the job, Thanks friends

    for Jukka: It is a php function, because I generate My HTML using a php
    script.

    Thanks.

    "toufik toufik" <> wrote in message
    news:8gBIc.5867$...
    > I like to make a link in a web page to the page itself,
    > I've tried <a href=".">, but it open the directory.
    >
    > Thanks for any help.
    >
    >
     
    toufik toufik, Jul 12, 2004
    #14
  15. toufik toufik

    Toby Inkster Guest

    toufik toufik wrote:

    > for Jukka: It is a php function, because I generate My HTML using a php
    > script.


    Then use:
    <a href="<?= $_SERVER['PHP_SELF'] ?>">current page</a>

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
     
    Toby Inkster, Jul 12, 2004
    #15
  16. toufik toufik

    brucie Guest

    in post: <news:4all.nl>
    Kris <> said:

    >> By URL specifications, "#" is a reference to the start of the current
    >> document.


    > Is it? I remember in another thread very recently (sorry I cannot come
    > up with a ref to back that up) it was brought up that the behaviour of a
    > an empty fragment identifier is unspecified and hence unpredictable.


    '#' is neither a URI nor a fragment identifier but "is used to delimit a
    URI from a fragment identifier in URI references [RFC2396 2.4.3]" so the
    only logical interpretation is to consider href="#" an empty URI
    (href="") in which case "an empty URI reference within a document is
    interpreted as a reference to the start of that document [RFC2396 4.2]"

    but some UAs do nothing.

    --
    b r u c i e
     
    brucie, Jul 12, 2004
    #16
  17. toufik toufik

    brucie Guest

    in post: <news:8gBIc.5867$>
    toufik toufik <> said:

    > I like to make a link in a web page to the page itself,


    <a href="<?=$PHP_SELF;?>">chunky bum</a>

    --
    b r u c i e
     
    brucie, Jul 12, 2004
    #17
  18. toufik toufik

    rf Guest

    "Kris" <> wrote in message
    news:4all.nl...
    > In article <>,
    > Dylan Parry <> wrote:
    >
    > > >> By URL specifications, "#" is a reference to the start of the current
    > > >> document.
    > > >
    > > > Is it?

    > >
    > > Like Jukka says, "specifications". As we all know, not all browsers are
    > > written to the standards, and as such the behaviour is unpredictable.

    >
    > No. I really recall someone drumming up a specification that says that
    > there has to be a (non whitespace) character after the # character.


    That was I.

    <quote>
    My feeling is that it is an error condition. The spec talks about what to do
    with a fragment identifier that is incorrect (perhaps misspelt) but not
    about one that is simply missing.

    <researches>

    RFC1738 talks about fragment/anchor identifier but only that it might be
    there (including the #).

    RFC1808 mentions fragment identifier by pointing out that "a parser must be
    able to recognise the fragment when it is present".

    Aha, RFC1808, in section 2.2 defines in modified BNF form
    "fragment = 1*pchar"
    and mentions that the 1* means "[one] or more repetitions of the [pchar].

    So, zero repetitions is not allowed and href="#" is therefore an error.

    Since it is an error then the browser, as per the spec, is at liberty to
    interperet it as the browser sees fit. There is no "correct" behaviour.
    </quote>

    --
    Cheers
    Richard.
     
    rf, Jul 13, 2004
    #18
  19. toufik toufik

    brucie Guest

    in post: <news:ZhFIc.91506$>
    rf <rf@.invalid> said:

    > Aha, RFC1808,


    RFC2606 is new and improved with only one third the fat so its healthier
    for you.

    > So, zero repetitions is not allowed and href="#" is therefore an error.


    but.. but.. but.. even if that is so a '#' and the fragment is not part
    of a URI so a href="#" is an empty URI and we all know "an empty URI
    reference within a document is interpreted as a reference to the start
    of that document"

    --
    b r u c i e
     
    brucie, Jul 13, 2004
    #19
  20. toufik toufik

    brucie Guest

    in post: <news:mbhwsynzw5e3$>
    brucie <> said:

    >> Aha, RFC1808,


    > RFC2606


    i'd just like to make it clear that i blame my mother for smoking crack
    when she was pregnant with me.

    RFC2396


    --
    b r u c i e
     
    brucie, Jul 13, 2004
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. CRON
    Replies:
    24
    Views:
    203,768
    Adrienne Boswell
    Jun 20, 2006
  2. Soren Vejrum
    Replies:
    4
    Views:
    763
    Lasse Reichstein Nielsen
    Jul 5, 2003
  3. saiho.yuen
    Replies:
    3
    Views:
    549
    kaeli
    Sep 14, 2004
  4. Replies:
    2
    Views:
    629
  5. Replies:
    3
    Views:
    416
Loading...

Share This Page