单独页面与动态内容加载 [英] Separate pages vs dynamic content loading

查看:60
本文介绍了单独页面与动态内容加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如今,许多Web应用程序都使用通过jQuery或AJAX进行某种动态内容加载,而不仅仅是链接到新的单独页面,从而使用户可以在不真正切换到另一个站点的情况下浏览网页.通常,这种网络技术似乎更快,因为请求具有较小占用空间的内容(例如JSON编码的数据)更快,因此对站点性能更好.

Many web applications use some kind of dynamic content loading via jQuery or AJAX nowadays instead of just linking to new separate pages, letting the user navigate through the web page without really switching to another site. Often this kind of web technology seems to be faster, because requesting something with a smaller foot print (like JSON encoded data) is faster and therefore better for site performance.

但是许多Web项目更喜欢旧样式"模型:您链接到另一个页面,如果用户导航到另一个页面,则需要从服务器请求整个HTML文件.

But a lot of web projects prefer the "old styled" model: You link to another pages, if the user navigate to another page a whole HTML file is requested from the server.

这两种情况的利弊是什么?您认为现代Web应用程序的正确方法是什么?

What are the pros and cons for both cases? What is, in your opinion, the right way for modern web applications?

请注意,这与静态页面与动态页面,客户端框架与服务器端框架或它们的组合无关.通常,这只是您对这个主题的看法.

Please note that's not about static vs. dynamic pages or client-side frameworks vs. server-side frameworks or the combination of them. It's just about your perspective about this topic in general.

谢谢.

推荐答案

您可能会被拒绝,因为问题不仅是针对特定技术问题的讨论,而且无论如何:

You're probably gonna be shot down, since the question is a discussion more than a specific tech-question, but anyway:

静态内容加载与动态内容加载-两者都有自己的位置.使用动态内容加载实际上并没有什么问题,只要在用户未打开javascript的情况下仍具有备用功能,可以创建可添加书签的链接(以便可以轻松地再次找到内容),就可以了.t加载过多的数据(因为动态内容的加载时间会在数据加载过多的情况下消除任何好处).

Static vs. dynamic content loading - both have their place. There isn't really anything wrong with using dynamic content loading, as long as you still have a fallback in place in case users doesn't have javascript turned on, create bookmarkable links (so the content can be easily found again), doesn't load too much data (because the load-time for the dynamic content will remove any benefits if the data-load is too heavy).

大多数静态网站都是缓存的,只要内容不太繁琐(再次),加载新页面就不会花那么长时间.使用动态内容加载可以更轻松地完成操作,即可以在后台进行预加载,可以轻松创建更多的奇特效果(淡入和淡出),等等.

Static sites are mostly cached, and as long as the content isn't too heavy (again), loading the new page isn't gonna take that much longer. What can be done more easily with dynamic content loading is that you can do preloading in the background, you can create more fancy effects (fade-ins and -outs) easily, and so on.

您需要做的是考虑页面的内容-进行简单的基于页面的加载(例如,网上商店或新闻站点)是否有益,或者它是一个更简单的站点,而无需多个页面?级别深层链接.如果是后者,则动态加载内容可能是一种更好,更快的方法.

What you need to do is think about what the page is - is it beneficial to have simple, page-based loading (for instance a webshop or news-site), or is it a simpler site, without the need for several levels deeplinking. If it is the latter, having dynamic content loading might be a better, and quicker, way to go.

而且,使用这两种技术都没有错.对主要内容使用常规链接和页面,对用户可以操纵的特定内容使用动态内容加载.基于站点内用户交互来重新加载表或信息列表,而不必重新加载,对于用户而言既可以更快,也可以减少烦恼".

Also, there is nothing wrong with using both techniques. Using regular links and pages for main content, and using dynamic content loading for specific content that a user can manipulate. Reloading a table or list of information based on user-interaction within the site, without having to reload, might both be faster and less "jarring" for the user.

这篇关于单独页面与动态内容加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆