Why not just using ajax for Page Requests to load the page content?

后端 未结 9 907
醉话见心
醉话见心 2021-01-13 07:47

Many web pages load all of their content to change very little information.

Now I would like to know why shouldn\'t the developers just use ajax for the main page re

相关标签:
9条回答
  • 2021-01-13 08:09

    Well if you want to AJAX load new pages, such as the same way Gmail works, I suggest your links are normal A HREF links that point to a true full rendering page URL and alos use an onclick event that stop the attempt at normal link loading and make your AJAX calls. The problem here is you'll be doing almost double coding unless you architecture this all very well.

    This way the normal non JS links load the full page, and the JS calls only load the new parts or page. This means spider indexing works again too.

    0 讨论(0)
  • 2021-01-13 08:10

    Search engines, crawlers/spiders, browsers with no javascript, screen readers and other consumers of the content will not be very happy with it.

    You can provide tons of ajax behavior on top of you website if you already support standard server side navigation for the full content. Have a look at progressive enhancement (SO) and progressive enhancement (wiki).

    0 讨论(0)
  • 2021-01-13 08:10

    I use only JavaScript and EJS as template Engine for my own webside. One step closer to SOFEA/SOUI.

    Search engines, crawlers/spiders, browsers with no javascript, screen readers dislike it, right. But I follow the mainstream ;)

    0 讨论(0)
  • 2021-01-13 08:14

    Aside from the answers already posted, using AJAX can have ugly side effects on browser control, such as the stop button not working.

    0 讨论(0)
  • 2021-01-13 08:20

    The biggest con are users who have JavaScript disabled. Your website simply won't work for them.

    0 讨论(0)
  • 2021-01-13 08:21

    One thing is that you want content to have a static url, you want people to be able to link to your pages, bookmark them, etc.

    If everything is ajaxified, this could be tricky and/or tedious.

    0 讨论(0)
提交回复
热议问题