swift/js还原网络视图向前列表

发布于 2025-01-21 23:00:19 字数 507 浏览 1 评论 0 原文

我正在尝试弄清楚如何在WKWebView中恢复后退列表。 Apple默认将重新阅读的后置列表。但是,Firefox,Chrome和其他移动浏览器都可以将其恢复每个会话。

这就是Firefox在iOS上恢复它的方式: https://github.com/mozilla-mobile/firefox-ios/wiki/historation-restoration-restoration-in-wkwebview-(and-error-pages)

这是JS/HTML代码用于访问DOM历史记录API:

​在应用中?

似乎您需要访问指向此JS文件的 local:// url。

I am trying to figure out how to restore the back forward list in a WKWebView. Apple defaults the BackForwardList to be readonly. However, FireFox, Chrome, and other mobile browsers are able to restore it each session.

This is how FireFox restores it on iOS: https://github.com/mozilla-mobile/firefox-ios/wiki/History-Restoration-in-WKWebView-(and-Error-Pages)

Here is the JS/HTML code that's used to access the DOM History API: https://github.com/mozilla-mobile/firefox-ios/blob/041c85483b1aa4a4e357d8bd9419550e4f20347a/Client/Assets/SessionRestore.html

In order to load this file and restore a WKWebView's history, do you need to spin up a local server within the app?

It seems like you would need to in order to access a local:// url that points to this JS file.

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

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

发布评论

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

评论(1

萌无敌 2025-01-28 23:00:19

是的,这就是他们正在做的事情,根据。代码中有许多引用 internal:// internurl struct in urlextensions.swift.swift 。该文件中也有会话恢复的内容,例如 var issessionRestore:bool

如果还没有,请克隆该项目并将其打开在XCode中,以更轻松地导航和搜索。

Yes, that's what they are doing, according to WebServer.swift. There are many references in the code to internal://, and an InternalURL struct in URLExtensions.swift. There are session restoration things in that file as well, such as var isSessionRestore: Bool.

If you haven't already, clone the project and open it in Xcode for easier navigation and searching.

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