Rails response to URL ajax crawling enabled
The google guide Making AJAX Applications 开发者_如何学JAVACrawlable tells how to format your url with hash an !
in order to make your site crawlable. A good example for that is the new twitter. If you type the URL:
http://twitter.com/dinizz
You will be redirected to:
http://twitter.com/#!/dinizz
I realized that the redirection is made on the server side, because i have tried to do with javascript and turns to every time that i'd change the url the browser reloads the page, i am trying to do on the server side with Ruby on Rails without success.
any help?
UPDATE: I found another question that address the same problem: How to show Ajax requests in URL?
This can't be sensibly done server side.
What should happen is that a client without JS will request the page, and then get data they can use.
If you redirect server side, then they will request the page, get a redirect to the homepage with a fragment identifier, and then get the default content of the homepage.
You have to do the redirect in JS on the client side.
精彩评论