通过webview加载页面时会加载两遍,走两个onLoadIntercept、onPageBegin、onPageEnd,这是什么问题啊?
可以通过什么方式,让webview只走一次生命周期吗?如果不行,可以通过什么方式知道是第一次,还是第二次呢?
发现在onPageBegin中调用setCustomUserAgent导致的:
this.webviewController.setCustomUserAgent(this.userAgent)
在加载前调用setCustomUserAgent,报错:Error message:Init error. The WebviewController must be associated with a Web component
应该怎么调用setCustomUserAgent呢?
setCustomUserAgent推荐设置的位置是onControllerAttached回调事件中