Forum Moderators: open

Message Too Old, No Replies

Broken Fragment Error

         

Marfola

1:54 pm on Feb 19, 2009 (gmt 0)

10+ Year Member



My anchor links, which are managed corretly in IE and Firefox, return a "Broken fragments error" in the W3C Link checker.

FYI: The error doesn't show in Xenu.

Should I ignore the error message in the W3C Link checker?

tedster

7:19 pm on Feb 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A fragment identifier in the url is a # character followed by a further character string, let's say for example: href="pagename.html#qwerty"

The broken fragment error is telling you that somehwere you have such a fragement identifier in the href url but the page that it targets does not have any code such as either <foo id="qwerty"> or <a name="qwerty">

You should either drop the fragement identifier from the link altogether, or add the actual fragment to the target page.

Marfola

12:33 pm on Feb 20, 2009 (gmt 0)

10+ Year Member



When I transformed my header from HTML to XHTML 1.0, I changed my anchors from <a name="fragment"></a> to <h1 class="subtitle" id="fragment">subtitle</h1> as suggested by encyclo in [webmasterworld.com...]

The W3C Link Checker returns a broken fragment error yet when I click “http://www.example.com/pagename.html#fragment” I get “pagename.html” anchored to “fragment” in both IE and Firefox.

FYI: I tried <foo id="fragment"></foo> as well it also returns a broken fragment error.

Is this a bug?

tedster

9:39 pm on Feb 20, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sounds like a bug in the link checker then - something you certainly can ignore, at any rate.

Marfola

8:57 am on Feb 23, 2009 (gmt 0)

10+ Year Member



thanks

g1smd

10:40 am on Feb 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Older HTML only allowed the #fragment to point to an a name="fragment" element.

Newer XHTML allows it to point to any element with an ID inside.

The error might simply be down to which DOCTYPE you are using.

Marfola

10:21 am on Feb 25, 2009 (gmt 0)

10+ Year Member



I'm using the following DOCTYPE

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Is there a better one?

tedster

9:51 pm on Feb 25, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's a good thread from the HTML Forum Library [webmasterworld.com], linked near the top of each forum page:

FAQ: Choosing the best doctype for your site [webmasterworld.com]

Marfola

8:45 am on Feb 27, 2009 (gmt 0)

10+ Year Member



thanks for the advice.