Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the pros and cons of building an AJAX-heavy web app over one with persistent URLs? [closed]

Tags:

javascript

Original Question: Is it a bad idea to make an all JavaScript website?

*Changed the question because this ended up being more of a discussion, but it could be helpful for others.*

In this case, I was thinking of making a website that initially delivers its overall layout using regular HTML (like a normal, basic web page), but then I plan to fill the content of the HTML content area dynamically, entirely with AJAX requests.

Users of the site won't ever be refreshing the page or going to a new page, and all other divs and elements that need to be generated will be created using AJAX (making use of lots of JavaScript functions that are on a cached external JavaScript page).

Although I'm not actually making a forum website, a forum's level of functionality is close to what I want to achieve. Lots of database reading and writing too.

Is this a bad idea? Am I not considering something that could make this potentially terrible? Is it good performance-wise (since I'll be doing so much client-side work and less server side work)?

I realize that the page wouldn't work for people who have JavaScript turned off, but that's not a concern in this case. I'm also not worrying about any mobile devices that don't support JavaScript, since I would probably just create a mobile-specific version of the site that doesn't use JavaScript).

Thanks!

UPDATE: First: Thank you for all the responses, everyone! I really appreciate it!

Just for clarification purposes, I thought this would be a good idea mostly because it seemed like I could just say, "Hey AJAX, just give me the raw forum post data for this page and I'll do all of the HTML building on the client side." Same DB access of course, but less server side page formatting work and less data transfer to the client.

And another important clarification: I'm not worried about search engine optimization because this forum would be a login-only network that should not be crawled or viewed by non-logged-in users.

like image 351
hithere Avatar asked Jul 03 '11 02:07

hithere


People also ask

What are the disadvantages of AJAX?

The disadvantages of AJAX are: - Search engines would not be able to index an AJAX application. - The server information can not be accessed within AJAX. - AJAX is not well integrated with any browser.

What are not the advantages of AJAX?

Speeder retrieval of dataDisadvantages of AjaxFollowing are the disadvantages of Ajax: 1. AJAX is dependent on Javascript. If there is some Javascript problem with the browser or in the OS, Ajax will not support 2. Ajax can be problematic in Search engines as it uses Javascript for most of its parts.


1 Answers

Not a crazy idea at all, but I recommend against it since it'd be hard to maintain. You just got to know what you're getting in to. Facebook does something similar. The Google search interface, for example, also keeps you on the same page when you perform a search.

You might also be interested in:

Backbone.js http://documentcloud.github.com/backbone/

and BBQ (Back Button Query) http://benalman.com/code/projects/jquery-bbq/docs/files/jquery-ba-bbq-js.html

One disadvantage is that analytics scripts won't necessarily work properly on sites built this way, depending how you build them.

Edit:

One concern is that it won't be search engine crawlable. This can be overcome if you build the site well, probably using BBQ, and by following this spec:

http://code.google.com/web/ajaxcrawling/docs/specification.html

like image 191
Geoff Avatar answered Sep 22 '22 16:09

Geoff