4 ms·
Why don't you add href='#' and return false from the click event. Nothing gets added to the history that way. Better yet, add a href='/uri/to/script' as a fall
by yaix 15y ago
Why don't you add href='#' and return false from the click event. Nothing gets added to the history that way.
Better yet, add a href='/uri/to/script' as a fallback in case the user has JS disabled.
- citricsquid 15y agoI was under the impression this (href=uri, js fallback) was the accepted standard, is it not?
- trb 15y agoIt is, the comments on the blog say as much as well. Use href="#" if a link makes no sense (anything UI-related and ephemeral, basically).
- pornel 15y agoEven many UI-related items could have sensible URL, e.g. href="#show-widget" (and read location.hash and perform that action when page is loaded). The href is not only for JS-less browsers, it's also for links opened in new tab or saved in browsing session.
- pgsnonsense 15y agoAs soon as you are providing "fallbacks" you have lost. There is no "web-app" standard which is why providing a "web-app" solution is ALWAYS a losing prpposition. HTTP is NOT an applicarion delivery protocol. Stop treaing it as such... as m uch as the cocksucker pg might try to convince you otherrwise.
- freakinjoe 15y agohref="javascript:;"
- pilif 15y agoYou really should not return false from event handlers. Returning false is equivalent to calling both preventDefault() (that's what you want) AND stopPropagation() By stopping propagation, you break delegation and make it impossible at worst and very random at best to add another handler to the same event. Just use preventDefault o stop the browser from following the link.
- cema 15y agoReturning false is equivalent to calling both preventDefault() (that's what you want) AND stopPropagation() This is so in jQuery. In basic Javascript "return false" does not stop the propagation. See http://stackoverflow.com/questions/1357118/javascript-event-preventdefault-vs-return-false http://stackoverflow.com/questions/1357118/javascript-event-...