4 ms·
Well, firstly a link tag with an empty href is semantically meaningless, and it probably doesn't validate either. More importantly this is part of a common pat
by JonnieCache 16y ago
Well, firstly a link tag with an empty href is semantically meaningless, and it probably doesn't validate either.
More importantly this is part of a common pattern for progressive enhancement. You create all your links with normal href attributes that point to real pages. If the browser doesn't have javascript enabled (eg. the googlebot) then navigation works as normal.
Then to enable your ajax navigation, you add an event handler to the links that pulls the href attribute out and retrieves the content at that url via ajax. You have your server notice that the request is an ajax one and only send back the content without the layout, which the js then uses to update the page. Obviously the browser must be prevented from following the link in the normal way.
Bingo, AJAX navigation without any extra markup, and with a flawless fallback.
- kragen 16y ago<a name=""> has been legal since before HTML had veersion numbers.