devedbox / AXWebViewController

AXWebViewController is a webViewController to browse web content inside applications. It’s a lightweight controller on iOS platform based on WKWebView (UIWebView would be the base Kit under iOS 8.0). It added navigation tool bar to refresh, go back, go forward and so on. It support the navigation style on WeChat. It is a simple-using and convenient web view controller using inside applications.
MIT License
797 stars 133 forks source link

SPA上的问题 #28

Open CrazyCoderShi opened 7 years ago

CrazyCoderShi commented 7 years ago

我目前也在封装webView(WKWebView)相关的东西 在封装的过程中,发现,如果web页面是使用SPA(Vue.js, React, Angluar.js等)方式来做的,那么就会造成backForwardList(返回栈)紊乱的问题,这会导致,用户在点击返回按钮来执行goBack的时候,会出现多1-2个栈 希望repo主一起研究 我目前的解决方式是:

  1. 通过KVO的方式来observe每个页面的title,并且在对应的.h开放indexTitle属性

2.如webView.title == indexTitle,这个时候让返回按钮执行popAction

3.反之,执行goBackAction

devedbox commented 7 years ago

@CrazyCoderShi 我也遇到过这个问题,但是没怎么关注,毕竟web环境不是单一的,我目前的解决方法是尽量避免这个问题,在我的项目中基本很少使用SPA。你的这个解决方案,有没有什么隐患呢?

CrazyCoderShi commented 7 years ago

@devedbox 目前来说,没有发现问题 我是觉得这样的方式,是不是太low了,想着你们可能有更好的解决方案😄