diff --git a/android/capacitor/src/main/java/com/getcapacitor/BridgeWebViewClient.java b/android/capacitor/src/main/java/com/getcapacitor/BridgeWebViewClient.java index a2b81a85e8..9335185862 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/BridgeWebViewClient.java +++ b/android/capacitor/src/main/java/com/getcapacitor/BridgeWebViewClient.java @@ -1,5 +1,6 @@ package com.getcapacitor; +import android.graphics.Bitmap; import android.net.Uri; import android.webkit.WebResourceRequest; import android.webkit.WebResourceResponse; @@ -43,4 +44,10 @@ public void onPageFinished(WebView view, String url) { } } } + + @Override + public void onPageStarted(WebView view, String url, Bitmap favicon) { + super.onPageStarted(view, url, favicon); + bridge.reset(); + } } diff --git a/android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java b/android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java index b0da6c14ad..bf1491d01b 100755 --- a/android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java +++ b/android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java @@ -266,7 +266,6 @@ private WebResourceResponse handleLocalRequest(WebResourceRequest request, PathH responseStream = jsInjector.getInjectedStream(responseStream); - bridge.reset(); int statusCode = getStatusCode(responseStream, handler.getStatusCode()); return new WebResourceResponse( "text/html", @@ -295,7 +294,6 @@ private WebResourceResponse handleLocalRequest(WebResourceRequest request, PathH // TODO: Conjure up a bit more subtlety than this if (ext.equals(".html")) { responseStream = jsInjector.getInjectedStream(responseStream); - bridge.reset(); } String mimeType = getMimeType(path, responseStream); @@ -351,7 +349,6 @@ private WebResourceResponse handleProxyRequest(WebResourceRequest request, PathH } InputStream responseStream = conn.getInputStream(); responseStream = jsInjector.getInjectedStream(responseStream); - bridge.reset(); return new WebResourceResponse( "text/html", handler.getEncoding(),