W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2005

[whatwg] Fragment Loading (not xmlhttp and iframe buffers)

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Fri, 29 Apr 2005 22:08:36 -0700
Message-ID: <c9e126605042922083f46ce02@mail.gmail.com>
There is no current standard way to load content into an element.

There is no way to load content into an element without using javascript.  

Everyone wants to use XmlHttp now and not really caring much about
accessibility. It is a desirable effect, and not one that is easy to
acheive gracefully.

I propose a simple way to load content into an element by using an a
href and giving the target an IDREF value (of a node in the containing
document). If the node-finding operation fails (due to the node not
being found or the browser not supporting the operation), the browser
will open a new window (this is what browsers do now)

<a href="ch2.html#part1" target="#section" fragment="part1.html">part 1</a>

Attributes:

href -
The user agent downloads the file in href. 

If a hash is specified, the browser loads the document fragment
contained by the IDREF  specified in the hash. The user agent may
optionally download only the fragment, to increase performance.

target -
the target can now be an IDREF of a node in the document. If the
target attribute begins with a  hash mark, the contents of the element
matching that IDREF will be cleared and new contents will be loaded
into the element.

fragment -
If the fragment  attribute is specified, the user agent ignores the
href and downloads the content specified for the value of the fragment
attribute.

Example:

<a href="ch2.html#part1" target="#section" fragment="part1.html">part 1</a>

<div id="section">
<h1>This is some content  that will be cleared</h1>
</div>

If a user clicks on the link, the file "part1.html" will load into the
div with the id="section".

If the operation fails, the browser opens a new window and loads the
file "ch2.html#part1".

The reason for having a fragment attribute is so that authors can
specify a document fragment and then have a fallback for user-agents
which do not support fragment loading.

There you have it, loading document fragments without javascript. What
more could you ask for?
Received on Friday, 29 April 2005 22:08:36 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:40 UTC