lundi 3 août 2015

Web application design with/without ajax

Let's say I am creating a webapp for a library. My base url is http://mylibrary.com. I want to use "pretty" URLs as follows:

  1. http://ift.tt/1M6q9ag (list all books)
  2. http://ift.tt/1g0cgwt (details of a particular book)

At present my approach is to create a single page app and use history api to manage the URLs. i.e I load all CSS and JS files when the user visits the home page. From then I just get data from server using AJAX, in JSON format and then create the required HTML using Javascript.

But I have learnt that this is not so good from SEO point of view.If a crawler were to visit http://ift.tt/1M6q9ag it will not see booklist at all because AJAX calls would not take place.

My question is what is the other approach to design this kind of app ? Specifically:

  1. Should the server create entire web page and send it to browser? I mean will the response from server include everything from <html> to </html> or only the required parts?
  2. Do programming languages like PHP efficiently manage to send the HTML to clients ? I would rather have the webserver do it ..
  3. It appears to me that in this scenario AJAX would have very little role to play other than may be change minor parts of the page. Is that a correct understanding ? ..and here I was thinking AJAX is the modern way of doing things ..

I am mostly a self taught developer so it is likely I have got some wrong notions in my head. Would like to hear from experienced pros. Thanks!

Aucun commentaire:

Enregistrer un commentaire