When one wants to refer to some part of a webpage with the "http://example.com/#foo" method, should one use
<h1><a name="foo"/>Foo Title</h1>
or
<h1 id="foo">Foo Title</h1>
They both work, but are they equal, or do they have semantic differences?
http://example.com#fooandhttp://example.com/#fooare equivalent as defined in one of the RFCs on URIs.<h1 id="foo"></h1>can be referenced fromwindow.fooin Javascript, which may not be what you are expecting, see stackoverflow.com/a/28568419/247696