简体   繁体   English

在单个页面上加载网站的所有项目

[英]Loading all items of a website on a single page

Think of a website that is supposed to show some items(eg products of a store).想想一个网站,它应该展示一些项目(例如商店的产品)。 Such websites try to put a limited number of items(say 24) on a single page and show the remaining number of pages down at the bottom next to a "next" and a "previous" button that takes you to the next or previous page with other(24) items.此类网站尝试在单个页面上放置有限数量的项目(例如 24 个),并在底部的“下一页”和“上一页”按钮旁边显示剩余的页数,可将您带到下一页或上一页与其他 (24) 项。 Now I'm looking for a way to load all these items on a single page all at once( without any next button).现在我正在寻找一种方法来一次在一个页面上加载所有这些项目(没有任何下一步按钮)。 IS there an easy way to do such a thing in inspect?有没有一种简单的方法可以在检查中做这样的事情? Maybe there is an items-per-page variable which I can change its value.也许有一个 items-per-page 变量,我可以更改它的值。 Or even some lines of code in JS?或者甚至是 JS 中的一些代码行? I should point out that I only have rudimentary JS skills.我应该指出,我只有基本的 JS 技能。

This depends entirely on the implementation of the website.这完全取决于网站的实施。 You can check the Network panel of the developer tools in Chrome or Firefox to see what network requests are being sent, and try to identify the request that loads the items.您可以在 Chrome 或 Firefox 中查看开发者工具的网络面板以查看正在发送哪些网络请求,并尝试识别加载项目的请求。 If you are lucky, the API will allow you to specify how many items you want to see.如果幸运的话,API 将允许您指定要查看的项目数量。

Most websites should only request the items necessary for the current display, so there is no client-side JavaScript that could make them all be shown at once.大多数网站应该只请求当前显示所需的项目,因此没有客户端 JavaScript 可以使它们一次全部显示。 Loading only what is necessary saves time and internet bandwidth - imagine a store with hundreds or thousands of products, loading all of them at once would be catastrophic for page load times.只加载必要的内容可以节省时间和互联网带宽 - 想象一下拥有数百或数千种产品的商店,一次加载所有这些产品对于页面加载时间来说将是灾难性的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM