Flutter - Block Webview Cookies in WKWebView

381

There is a way to clear the cookies:

final CookieManager cookieManager = CookieManager();
final bool hasCookies = await cookieManager.clearCookies();

You can check the same in the unit tests file. Attaching the file reference https://github.com/flutter/plugins/blob/master/packages/webview_flutter/webview_flutter/test/webview_flutter_test.dart

Share:
381
thebenCA
Author by

thebenCA

Updated on January 01, 2023

Comments

  • thebenCA
    thebenCA over 1 year

    Our flutter app uses webview to give users access to our online retail store. This retails store uses cookies.

    This hasn’t been a problem until this week. As of last week, Apple started rejecting our updates because the webview section of the app uses cookies.

    We would like to configure the webview widget to block all web cookies by default.

    We’re using the webview_flutter widget, which uses WKWebView for iOS under the hood.

    Is there a way to automatically block all web cookies via the webview?

  • thebenCA
    thebenCA over 2 years
    thanks for the info. My concern is that Apple will not approve the app unless we are able to block cookies from setting.