Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经为列表进行了分页。该列表包含不同页面的链接。当用户转到不同的页面并返回到分页所在的页面时,“保存”分页“页面”的最佳方法是分页被重置为第一页。将当前页面保存到 cookie 或什么?有没有保存分页的例子?
当用户与分页交互时,使用location.hash.
location.hash
例如,这可能等同于分页结果的第二页:
index.html#2
这涵盖了浏览器历史记录 - 离开页面并点击“后退”按钮。这也意味着他们可以直接链接到它并发送该链接。
为了让他们直接返回网站并保留分页,然后求助于 cookie。
总结:饼干和location.hash