开发者

AJAX SEO Friendly and History Navigation

开发者 https://www.devze.com 2023-01-31 03:10 出处:网络
i\'m working on some website that has a section with pure AJAX, but i want it to have SEO Friendly URL\'s.

i'm working on some website that has a section with pure AJAX, but i want it to have SEO Friendly URL's.

I've been googling and saw that i can make all my links "Return false", that way i can have my url's working awesome with search engines... but i h开发者_运维问答ave a problem, i want it to have history too, but i dont know how to make it... something like this:

<a href="contacts.html">Contacts</a>

And onclick = return false; but i need it to have

<a href="#contacts">Contacts</a>

so the history and back button can work...

I was thinking if i could just use the History type (using #) but i dont know how friendly is that type of URL.

Any tip or Idea?!

Thank you!!


HTML5 introduced some ways of controlling the history of the browser. See the MDC Doc on "Manipulating the browser history". Using history.pushState() you can both have the history cake and eat the ajax cake. This would only work in the latest browsers as with much of the new and fancy HTML5 features.

Also, using an click event handler that calls event.preventDefault() is preferred to using return false.

0

精彩评论

暂无评论...
验证码 换一张
取 消