如何在 Firefox/Chrome 中保存选项卡的内存状态?
我希望能够在 Firefox 或 Google Chrome 中保存选项卡的状态,以便稍后可以通过编写自定义附加组件/插件/扩展来恢复它。
我能找到的最接近的是 Firefox 的 session store API,它可以保存表单数据和滚动位置。但是,我也想保存 Javascript 状态。此外,如果可能的话,即使网站不再可用,我也希望能够恢复页面。如果有办法保存所有解析的资源/数据结构那就最好了。
任何主流浏览器都可以吗?
I want to be able to save a tab's state in Firefox or Google Chrome so that I can restore it later, through writing a custom add-on/plug-in/extension.
The closest thing I can find is Firefox's session store API, which can save form data and scroll position. However, I want to save Javascript state too. In addition, if possible, I want to be able to restore the page even if the website is no longer available. It would be the best if there a way to save all the parsed resource/data structure.
Is it possible for any of the major browsers?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用会话好友:https://chrome.google.com/webstore/detail/会话伙伴/edacconmaakjimmfgnblocblbcdccpbko。我已经使用它有一段时间了,它的作用正是你所说的,甚至更多。
Try using Session Buddy: https://chrome.google.com/webstore/detail/session-buddy/edacconmaakjimmfgnblocblbcdcpbko. I've been using it for a while now, and it does exactly what you're talking about and more.
只需序列化将页面状态恢复到 localStorage 所需的所有内容(它是持久的,与 sessionStorage 不同),并在页面的 DOMContentLoaded(或 load)事件处理程序中调用相应的反序列化函数。
Just serialize everything you need to restore your page state into a localStorage (it is persistent, unlike sessionStorage) and invoke a respective deserialization function in your page's DOMContentLoaded (or load) event handler.