开发者

Is there a problem with using all AJAX for server calls in a public site?

开发者 https://www.devze.com 2022-12-21 09:51 出处:网络
Understanding that if someone had JavaScript disabled the site would not work then is there any other reason not to do this?

Understanding that if someone had JavaScript disabled the site would not work then is there any other reason not to do this?

I am in the design phase of a new site and want to make it easy to change the server code 开发者_StackOverflowwithout having to change the UI - just like a form.

This is using Python server side.


One problem, arguably, is that Ajax techniques break the back button.

By making all of your calls to the server Ajax calls, the user loses their ability to 'go back' to a previous view. Facebook exemplifies this. Click the back button on Facebook, generally, does not take you to the previous view you were presented with.

In addition, it is more difficult for a user to bookmark their current view of the site. This can make it difficult for them to share what they are seeing with others and can make it difficult to debug problems that users see; rather than just sending you a URL to recreate their problem, they have to figure out the numerous steps they took before they spotted a problem.

Personally, I think the best place for Ajax is for updating small segments of a page. If you have a page that is changing more than, say, 50%, you may want to rethink the sole use of Ajax


Potentially yes, here are two items that come to mind.

  1. Search indexing: this would have profound impact on what content on your site search engines like Google can index. Because the crawlers do not execute any AJAX script when reading your page.

  2. Performance: Too many AJAX calls can actually hinder performance and page load response times. AJAX should generally be used to update only specific parts of a given page if at all possible. If you can emit the majority of content in the first page get request you should, period.


For a desktop-like rich web application, I would say that the all AJAX approach is acceptable.

However unobtrusive JavaScript and progressive enhancement may be a better strategy for most categories of public web-facing interfaces.

0

精彩评论

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