jQuery Mobile - index.html 中的所有页面与单个外部页面 - 什么可以提供更好的性能?

发布于 2024-11-05 17:50:21 字数 297 浏览 1 评论 0原文

“jQuery Mobile“页面”结构经过优化,可以支持单个页面或页面内的本地内部链接“页面”。” jQuery 文档

是什么为 jQuery Mobile 应用程序提供了更好的性能 - 运行在电话间隙?

  • 所有页面都在 single.html 文件中,并且内部加载
  • 带有外部链接的单个页面

还需要考虑其他方面吗?

"The jQuery Mobile "page" structure is optimized to support either single pages, or local internal linked "pages" within a page." jQuery docs

What gives better performance for a jQuery Mobile application - which runs on PhoneGap?

  • all pages in a single.html file and internal loading
  • either single pages with external links

Any other aspects to consider?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

飘落散花 2024-11-12 17:50:21

我使用 jQuery mobile,我制作的所有网站都是一页网站。我创建的唯一外部页面是那些嵌入了 Google 地图的页面,这样如果用户不需要 iframe,就不会加载它。

我认为归结为:一个包含大量内容的页面可能会减慢初始加载速度,但加载后会更快,而一个小主页从一开始就会很快,但每个链接页面都会触发 Ajax 请求。在针对移动设备进行设计时,我的经验法则是尽可能减少 http 请求。尽管许多用户使用 3+ G 网络,但根据连接情况,仍然可能需要等待。此外,连接可能会在瞬间发生变化,如果用户已经成功地浏览网站,但突然速度变慢,这可能会让人感到有点沮丧。因此,我认为从用户体验的角度来看,如果加载后其他一切都很快,用户愿意在初始加载时等待一些额外的时间。

在一个页面中设计所有内容也有利于使用 jQM 进行开发,imo,因为我只是创建一个仅包含一页(以及 css 和 js 文件)的缓存清单。然后,即使用户没有连接,我的网站也会被缓存并运行。如果您使用过 applicationCache,您很快就会意识到,拥有的文件越多,维护缓存清单就越困难,并且更新速度就越慢。

I use jQuery mobile, and all the sites that I've made have been one page sites. The only external pages that I create are those that have embedded Google maps, just so the iframe loading doesn't happen if the user doesn't need it.

I think it boils down to this: one page with lots of content may slow initial loading but will be snappier once loaded, whereas a tiny home page will be quick from the start, buteach linked page will trigger an Ajax request. When designing for mobile, my rule of thumb is to minimize http requests as much as possible. Though many users are on 3+ G networks, it can still be a wait depending on connectivity. Also, connectivity can change in an instant and if the user has been navigating through the site successfully, and all of sudden things slow down to a crawl, this may create a bit of frustration. Therefore, I think from a user experience POV, users are willing to wait a few extra ticks on the initial load if everything else is quick once it's loaded.

Designing all in one page is also good for development with jQM, imo, because I just create a cache-manifest that includes only one page (and the css and js files). Then my site is cached and runs even if the user has no connectivity. If you've worked with applicationCache, you quickly realize that the more files you have, the more difficult it is to maintain the cache manifest and updates are slower.

梦行七里 2024-11-12 17:50:21

我不能过多谈论浏览器性能,但您应该考虑加载时间。
一个文档中的多个页面会随该文档一起加载,因此如果页面较多,DOMready 会在一段时间后发生,这可能会给人一种不愉快的外观。当您需要时,会使用单独的页面,因此如果没有理由使用多页,那么我建议坚持使用多个 HTML 文件。 对于在线应用程序

另外 - 如果您想坚持 JQM 的开发理念渐进增强,那么多页面就不能使用太多。

还有其他需要考虑的方面吗?

是的...据我所知,多页文档中仍然可能存在一些问题(例如对话框)。如果多页中有多个对话框,JQMalpha3 不想为我显示对话框。

I can't say much about browser performance, but you should consider load times.
Multiple pages in one document are loaded with the document, so if there's more of them, the DOMready will happen after some time, which can give an unpleasant look. Separate pages are fethed when you need them, so if there are no reasons to use multipage, then I'd recommend sticking with multiple HTML files. For an online app

Also - a multipage can't be used much if you want to stick with progressive enhancement which is JQM's development philosophy.

Any other aspects to consider?

Yes... As far as I know, there still might be some problems (eg. with dialogs) in multipage documents. JQMalpha3 didn't want to display dialogs for me if there was more than one in a multipage.

伊面 2024-11-12 17:50:21

这取决于您个人应用程序的大小,我已经意识到,如果您只有几页,则使用单页应用程序的响应速度更快,在我的情况下,只有 3 个屏幕加载外部数据,这比 3 个单独的页面响应速度更快。
希望有帮助

This depends on your app's size personally I've realised that using one page apps is more responsive if you have only a few pages in my case it was only 3 screens loading in external data which was more responsive than 3 seperate pages.
Hope that helps

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文