简体   繁体   English

是否有可能检测Android webview的goBack()是否从缓存中加载内容?

[英]Is it possible to detect if Android webview's goBack() will load content from cache?

I'm having issue with Android webview's goBack() not sending custom request headers and cookies. 我遇到了Android webview的goBack()无法发送自定义请求标头和cookie的问题。 I'm trying to fix this by reloading the whole page on goBack(), but it should be done only when goBack() is not going to load content from cache. 我正在尝试通过在goBack()上重新加载整个页面来解决此问题,但只有在goBack()不会从缓存中加载内容时,才应该这样做。 Is there a way to programmatically detect that webview's goBack() is going to load content from cache or not. 有没有一种方法可以以编程方式检测webview的goBack()是否要从缓存加载内容。 Thanks. 谢谢。

If the load isn't from the cache, then it will go through WebViewClient.shouldInterceptRequest . 如果负载不是来自缓存,则它将通过WebViewClient.shouldInterceptRequest Note that in the case of goBack , the shouldOverrideUrlLoading will not be called, as it is not called for navigations started via the Java API calls. 请注意,在goBack的情况下,将不会调用shouldOverrideUrlLoading ,因为对于通过Java API调用启动的导航, 不会调用shouldOverrideUrlLoading

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM