Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Href to the current page

Reply
Thread Tools

Href to the current page

 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      07-12-2004
Kris <(E-Mail Removed)> wrote:

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

>
> Is it?


It is. See RFC 2396, clause 4.2
which is available in HTML format at
http://www.cs.tut.fi/~jkorpela/rfc/2396/full.html#4.2

Technically, it also implies that href="" (i.e., with an empty string as
URL) has the same meaning.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


 
Reply With Quote
 
 
 
 
Kris
Guest
Posts: n/a
 
      07-12-2004
In article <(E-Mail Removed)>,
Dylan Parry <(E-Mail Removed)> 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
<(E-Mail Removed)> (nl)
 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      07-12-2004
"toufik toufik" <(E-Mail Removed)> 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


 
Reply With Quote
 
toufik toufik
Guest
Posts: n/a
 
      07-12-2004
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" <(E-Mail Removed)> wrote in message
news:8gBIc.5867$(E-Mail Removed).. .
> 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.
>
>



 
Reply With Quote
 
Toby Inkster
Guest
Posts: n/a
 
      07-12-2004
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

 
Reply With Quote
 
brucie
Guest
Posts: n/a
 
      07-12-2004
in post: <news:(E-Mail Removed)4all.nl>
Kris <(E-Mail Removed)> 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


 
Reply With Quote
 
brucie
Guest
Posts: n/a
 
      07-12-2004
in post: <news:8gBIc.5867$(E-Mail Removed) m>
toufik toufik <(E-Mail Removed)> 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


 
Reply With Quote
 
rf
Guest
Posts: n/a
 
      07-12-2004

"Kris" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)4all.nl...
> In article <(E-Mail Removed)>,
> Dylan Parry <(E-Mail Removed)> 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.


 
Reply With Quote
 
brucie
Guest
Posts: n/a
 
      07-13-2004
in post: <news:ZhFIc.91506$(E-Mail Removed)>
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


 
Reply With Quote
 
brucie
Guest
Posts: n/a
 
      07-13-2004
in post: <news:mbhwsynzw5e3$(E-Mail Removed)>
brucie <****@usenetshit.info> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to update the current web page? (delete current web page + rewrite the page) laryten@yahoo.com Javascript 3 10-12-2006 07:33 PM
href="javascript:func()" vs href="#" onclick="javascript:func()" CRON HTML 24 06-20-2006 08:05 PM
onClick method question (this.href and document.location.href) yogesh.bhardwaj@gmail.com Javascript 2 02-03-2005 02:38 PM
difference between location.href and window.location.href? saiho.yuen Javascript 3 09-14-2004 06:51 PM
Problem: Setting MSIE iframe innerHTML change relative href/src to absolute href/src Soren Vejrum Javascript 4 07-05-2003 01:47 PM



Advertisments