Skip to content

[Android] Fix IAB not destroyed when hidden #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/android/InAppBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,15 @@ public void onPageFinished(WebView view, String url) {
dialog.dismiss();
dialog = null;
}

// https://github.com/apache/cordova-plugin-inappbrowser/issues/290
if (url.equals("about:blank")) {
inAppWebView.onPause();
inAppWebView.removeAllViews();
inAppWebView.destroyDrawingCache();
inAppWebView.destroy();
inAppWebView = null;
}
}
});
// NB: From SDK 19: "If you call methods on WebView from any thread
Expand Down Expand Up @@ -948,9 +957,9 @@ public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePath
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setBuiltInZoomControls(showZoomControls);
settings.setPluginState(android.webkit.WebSettings.PluginState.ON);

// download event

inAppWebView.setDownloadListener(
new DownloadListener(){
public void onDownloadStart(
Expand All @@ -971,7 +980,7 @@ public void onDownloadStart(
}
}
}
);
);

// Add postMessage interface
class JsObject {
Expand Down