How can I restore a WKWebView to the state it was before the app closed?

前端 未结 2 1496
我寻月下人不归
我寻月下人不归 2021-01-14 11:00

I run into a dead end. I just can\'t figure out a way for restoring a WKWebView after the user has closed the app. All the web pages he visited must be there when he re-open

2条回答
  •  不知归路
    2021-01-14 11:42

    All the web pages he visited must be there when he re-opens it

    Impossible. The history of web pages visited - the backForwardList, and all its contents - is read-only. Nor is it saved and restored for you when you participate in view controller state saving and restoration.

    In my opinion, this is a major flaw in WKWebView.

    If you need this feature, revert to UIWebView, where it's all done for you like magic if you participate in view controller state saving and restoration.

提交回复
热议问题