broken URI fragments (such as index.html#fragment)
justin at justinhileman.info
Thu Apr 2 20:44:32 MDT 2009
Charles Curley wrote:
> While running the W3 Consortium's link checker
> I get messages like:
> Lines: 403, 405, 407, 409, 411, 413, 637 http://www.charlescurley.com/frames.article.html
> Status: 200 OK
> Some of the links to this resource point to broken URI fragments (such as index.html#fragment).
> Broken fragments:
> * http://www.charlescurley.com/frames.article.html#TOC128 (line 409)
> * http://www.charlescurley.com/frames.article.html#TOC130 (line 413)
> * http://www.charlescurley.com/frames.article.html#TOC126 (line 405)
> What do they mean by broken fragments?
> The anchors are there, e.g.:
> <h2><a name="TOC130">Acknowledgments</a></h2>
> and the links to them look like:
> <li><a href="frames.article.html#TOC130">Acknowledgments</a>
> Should I change anything?
RFC2396 (URI generic syntax) says that fragments refer to ID type
attributes. In HTML 4 and XHTML, this is the "id" attribute, not "name".
I.E. you don't actually have a target for that link, because there's no
anchor with that id. For backwards compatibility you can still browse to
an anchor via "name", but it's not XHTML strict. Since your page
declares a XHTML strict doctype, I imagine the validator is explicitly
looking for the id.
It will still work with "name", and will prob'ly always work that way.
If you want to validate links and/or make things future proof, you
should add an id to your anchors, e.g:
<h2><a id="TOC130" name="TOC130">Acknowledgments</a></h2>
See the XHTML 1.0 compatibility guidelines:
More information about the PLUG