3 ms·
I use A without href only when I'm making an actual anchor A name. When I use href=#, I always have javascript onclick return false. This won't stop crawlers bu
by chime 16y ago
I use A without href only when I'm making an actual anchor A name. When I use href=#, I always have javascript onclick return false. This won't stop crawlers but it keeps the user's history and address bar clean.
- jonah 16y agoAnother approach is href="javascript:;". Not as nice in your status bar but slightly less code and you don't need a big JS lib to implement it. (preventDefault is preferable though.)
- keyle 16y agowhat about href='' and in the jquery onclick function, return false at the end?
- chime 16y agohref='' will reload the current page in most browsers if the JS code hasn't loaded yet (waiting for $(function(){}) to fire) or has an error for some reason. href='#' will at least prevent that. Returning false form jQuery works.
- craigkerstiens 16y agoAdding a no follow on the link would stop the crawlers actually. Your current approach with return false and a no follow is the approach I most commonly use. The full result looking like: <a href="#" onclick="DoSomeStuff();return false;" rel="nofollow">