开发者

Page load vs html content load via Ajax

What are the issues/points to cons开发者_运维问答ider in the question page load vs html content load via ajax? The most of web sites has the same structure: header with menu, main content and footer. So, it looks very reasonable/sensible to load only the container with main content, not the complete page. But as I see this approach is not widely used. The main navigation remains implemented in "old style"-method (via a href). What is here important to think about? Thanks


Well I think this differs per person. I personally don't like using javascript if it isn't needed. While others do. There are some tools that fix most of the problems with javascript like hash links aka:

yoursite.com/#/path/to/object

That make it possible to use the back and forward key and send the links to your friends. Also using javascript does ease a bit on your bandwidth and pages load faster.

But you have to give up on google since google bot can't parse javascript sites. So for front end pages you are better off using normal HTML and for backend admin stuff you can use javascript to make your gui more user friendly and neat.


Think of mobile users and such without JavaScript support, people running older browsers, browser history, search engine spiders etc. - there's plenty of reasons to use traditional navigation.


A few reasons:

  • running two requests when one would be enough is wasteful
  • search engine friendlyness
  • increasing popularity of script blockers
  • caching
  • old browsers with incompatible javascript engines
  • accessibility
  • server-side code is easier to debug than ajax


Think about bookmarks, google bot, sending links to pages.

Other then that AJAX navigation is perfectly fine.


Cost (having to build it twice (or sacrifice non-JS users like search engines), breaking bookmarking, breaking back/forward, breaking sending a link to a friend. (These 'breaking' things can be worked around, but it is more work and still imperfect).

Vs benefit: Potential minor (since you are still loading the majority of the page) performance increase.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜