473,387 Members | 1,425 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Empty fragment

Is the following a legal URL?

http://www.invalid.com/path#

This underlies my real questions:

1. Is <a href="#"> a *valid* (whether or not intentionally) way to go to
the top of a page.

2. Whether or not valid, do the usual browsers actually support this?

I'm asking because I'm reviewing a large set of pages created by several
other people, and many of them are using this device to return to the
top of the page. (No need to reopen the argument about not using Back to
Top links at all--not my decision!)
Jul 24 '05 #1
5 2409
Harlan Messinger <hm*******************@comcast.net> wrote:
Is the following a legal URL?

http://www.invalid.com/path#
Yes.
This underlies my real questions:

1. Is <a href="#"> a *valid* (whether or not intentionally) way to
go to the top of a page.
AFAIK, the behavior is undefined for empty fragment identifiers. I'm
not sure though, so you may want to look into RFC 2396 (somewhere
around section 4 maybe).
2. Whether or not valid, do the usual browsers actually support
this?


IE, Mozilla and Opera does to my knowledge, and I think this is the
most common behavior for browswers.

--
David Håsäther
Jul 24 '05 #2
David Håsäther wrote:
Harlan Messinger <hm*******************@comcast.net> wrote:
Is the following a legal URL?

http://www.invalid.com/path#
I guess that should be either www.example.com or www.something.invalid.

Yes.
This underlies my real questions:

1. Is <a href="#"> a *valid* (whether or not intentionally) way to
go to the top of a page.


AFAIK, the behavior is undefined for empty fragment identifiers. I'm
not sure though, so you may want to look into RFC 2396 (somewhere
around section 4 maybe).


Yeah, it still doesn't seem to answer the question.
2. Whether or not valid, do the usual browsers actually support
this?


IE, Mozilla and Opera does to my knowledge, and I think this is the
most common behavior for browswers.


I just checked: even Lynx does.
Jul 24 '05 #3
Harlan Messinger <hm*******************@comcast.net> wrote:
1. Is <a href="#"> a *valid* (whether or not intentionally) way to
go to the top of a page.


AFAIK, the behavior is undefined for empty fragment identifiers.
I'm not sure though, so you may want to look into RFC 2396
(somewhere around section 4 maybe).


Yeah, it still doesn't seem to answer the question.


RFC 2396 has been superseded by RFC 3986 (STD 66) in January 2005.

I haven't studied RFC 3986 in detail, but it seems to have obscured
things somewhat. The one-character string "#" is surely a syntactically
correct URL, but its meaning is not explicitly defined.

P.S. "Valid" is not the right word here; e.g.
<a href="! ¤¤ ##%">foo</a>
is valid but incorrect.

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

Jul 24 '05 #4
Harlan Messinger wrote:
Is the following a legal URL?

http://www.invalid.com/path#
doesn't violate STD66 anyway.
This underlies my real questions:

1. Is <a href="#"> a *valid* (whether or not intentionally) way to go to
the top of a page.
valid, and moreover conforms to the text of the spec, read
loosely.

My take on it is, in a text/html doc, an empty fragment
designates an element named with the empty string (so that
element can't be named with 'id'). If that element doesn't
occur, the semantics of the fragment identifier are unknown.
2. Whether or not valid, do the usual browsers actually support this?


My Lynx (2.8.3) moves me to the top, no matter if an element's
named "" or not; but my Opera (7.54) does not move me to the
top, although if an element is named "" (even with 'id', which
violates the spec), it moves me there.

--
Jock
Jul 24 '05 #5
On Tue, 12 Jul 2005 20:07:30 GMT, John Dunlop
<us*********@john.dunlop.name> wrote:
Harlan Messinger wrote:
Is the following a legal URL?

http://www.invalid.com/path#


doesn't violate STD66 anyway.
This underlies my real questions:

1. Is <a href="#"> a *valid* (whether or not intentionally) way to go to
the top of a page.


valid, and moreover conforms to the text of the spec, read
loosely.

My take on it is, in a text/html doc, an empty fragment
designates an element named with the empty string (so that
element can't be named with 'id'). If that element doesn't
occur, the semantics of the fragment identifier are unknown.
2. Whether or not valid, do the usual browsers actually support this?


My Lynx (2.8.3) moves me to the top, no matter if an element's
named "" or not; but my Opera (7.54) does not move me to the
top, although if an element is named "" (even with 'id', which
violates the spec), it moves me there.


How come you're sensible over here?

BB
--
www.kruse.co.uk/ se*@kruse.demon.co.uk
seo that watches the river flow...
--
Jul 24 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Stuart Baker | last post by:
I just added session support to a web site and the URL's that contain a #fragment no longer function. Is there a delimiter that I can add following the #fragment that will tell the browser that the...
2
by: Victor | last post by:
While debugging my stylesheet using XMLSpy, I got a really weird result: <xsl:if test="$match = true()"> matches even if $match is an empty node fragment. How can this be? -- Victor
2
by: Roman O | last post by:
Hi all, Why Url.Fragment property is always empty?
7
by: Alan Johnson | last post by:
It seems useful to be able to distinguish between an empty weak_ptr and one that has merely expired. For example: void f(weak_ptr<T> wp) { if (/* wp is empty */) { // Act is if a NULL...
2
by: Todd Price | last post by:
I'm trying to use XPath to get a handle on one specific node so that I can replace it with an xml fragment I've loaded from another file. So if I have this XML: <issue> <id>1</id>...
8
by: yawnmoth | last post by:
Say I have the following HTML: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> </head> <body> <form action="">
1
by: Andy Fish | last post by:
Hi, using XSLT 1.0, consider something like this: <xsl: variable name="foo"> <apply-templates select="..." mode="..." /> </xsl:variable> <xsl:if test="$foo"> do something in here </xsl:if>
3
by: tschwartz | last post by:
I'm trying to write a stylesheet which removes nodes which are empty as a result of other template processing. For example, given the following xml, I'd like to: - remove all "b" elements -...
16
by: Lastwebpage | last post by:
Hello, I am little surprised about the following: <a href="#" ... I found some lines about the href tag for a site should point to an name or in XHTML to an ID, but in both cases this seems to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.