Client-side or server-side processing?

前端 未结 6 717
逝去的感伤
逝去的感伤 2021-02-05 10:22

So, I\'m new to dynamic web design (my sites have been mostly static with some PHP), and I\'m trying to learn the latest technologies in web development (which seems to be AJAX)

6条回答
  •  借酒劲吻你
    2021-02-05 10:30

    It depends on your target market and the goal of your site.

    I strongly believe in using the client side where ever you can to offload work from the server. Obviously its important you do it correctly so it remains fast for the end user.

    On sites where no-js support is important (public websites, etc), you can have fallbacks to the server. You end up doubling code in these situations but the gains are very beneficial.

    For advanced web applications, you can decided if making JS a requirement is worth the trade of losing a (very) few users. For me, if I have some control over the target market, I make it a requirement and move on. It almost never makes sense to spend a ton of time to support a small percentage of potential audience. (Unless the time is spent on accessibility which is different, and VERY important regardless of how many people fit into this group on your site.)

    The important thing to remember, is touch the DOM as little as possible to get the job done. This often means building up an HTML string and using a single append action to add it to the page vs looping through a large table and adding one row at a time.

提交回复
热议问题