mirror of
https://github.com/status-im/react-native-webview.git
synced 2026-08-31 03:31:05 +00:00
feat(android props): Add incognito to Android (#524)
This commit is contained in:
committed by
Thibault Malbranche
parent
1d649a81c8
commit
25bc5a55c6
@@ -328,6 +328,23 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||
public void setMessagingEnabled(WebView view, boolean enabled) {
|
||||
((RNCWebView) view).setMessagingEnabled(enabled);
|
||||
}
|
||||
|
||||
@ReactProp(name = "incognito")
|
||||
public void setIncognito(WebView view, boolean enabled) {
|
||||
// Remove all previous cookies
|
||||
CookieManager.getInstance().removeAllCookies(null);
|
||||
|
||||
// Disable caching
|
||||
view.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
|
||||
view.getSettings().setAppCacheEnabled(!enabled);
|
||||
view.clearHistory();
|
||||
view.clearCache(enabled);
|
||||
|
||||
// No form data or autofill enabled
|
||||
view.clearFormData();
|
||||
view.getSettings().setSavePassword(!enabled);
|
||||
view.getSettings().setSaveFormData(!enabled);
|
||||
}
|
||||
|
||||
@ReactProp(name = "source")
|
||||
public void setSource(WebView view, @Nullable ReadableMap source) {
|
||||
|
||||
Reference in New Issue
Block a user