Forum Moderators: Robert Charlton & goodroi
My question is "do search engines index named anchors?"
The methodology of implementing it is not a problem, but the SEO could be a problem. My implementation would be as follows
use OnClientClick method on my menu to execute some JavaScript. That JavaScript will update a Hidden Input on my page... and my OnClick method in my ASP.NET Code Behind would poll the database for the ID field stored in the Hidden Input and update a Panel using ASP.NET AJAX.
Handling AJAX intelligently in regard to indexing is an evelving art. If you really want individual content indexed, then AJAX may not be the appropriate technology. A new dedicated URL might work better than a dedicated server call to replace just part of the page. And if there's only a few possible changes to be made, consider a show/hide div solution where all the content is in the initial source code. An iframe can also do the job in some situations.
What I'm saying is that everything doesn't need to be handled with AJAX - there are times it's just the right tool for the job and others where it is problematic.
[edited by: tedster at 2:15 am (utc) on Oct. 14, 2008]
Return false from your onClick handler and have a valid non-JS URL in the href.
<a href="http://www.example.com/viewcontent.asp?id=401" onClick="return ajax_call(401)">Link</a> The function ajax_call must return false. Viewcontent.asp can be a simple reimplementation of your JS parsing via ASP to return the finished page directly as HTML.
Search engines, and users who do not use javascript, will no excute 'onClick' but will instead visit the HREF portion of the link.
In my opinion, if you've not got support for non-JS systems, you have not finished the code yet - it is essential both for users and for search engines.