4

First of all, I have a basic level of English so I hope that you understand.

What is the difference between incognito and cacheEnabled props in React Native WebView? react-native-webview doc don't have a detailed explanation.

incognito Does not store any data within the lifetime of the WebView.

cacheEnabled Sets whether WebView should use browser caching.

pedrohpinho
  • 63
  • 1
  • 4

1 Answers1

2

Based on the source code, the functionality is different between iOS and Android:

iOS:

Uses WKWebsiteDataStore.nonPersistent, which does not store anything to the disk.

Android:

  1. Removes all cookies from CookieManager.
  2. Clears all caches, forms, password etc. and disables caching
  3. Sets cache mode to LOAD_NO_CACHE (always from network)

All other than the first step also apply to cacheEnabled=false. I'm not sure how caching works in WKWebView. It may not cache anything by default, which would mean the incognito functionality is inline with Android. cacheEnabled=true/false does nothing in iOS.

Tapani
  • 3,191
  • 1
  • 25
  • 41