Home | All Questions | alt.html FAQ >

Is using <a href="#"> a good idea?

That's the usual trick. But in addition to not conforming to specifications (since "#" is not a URL reference that complies with URL syntax, still less is there any meaning assigned to it in the specs), it has the nasty effect of taking to the _top_ of the page on most browsers (and perhaps somewhere else on other browsers). This of course matters only when client-side scripting is not enabled - or when the author forgot to terminate the scripting code by return false. :-)

This is safer: <a name="this" href="#this">...</a> where "this" is any name you like, different for different <a> elements on the page. If the link is actually followed, it then takes to that very same location.

Recommended Resources


Related Questions