React Native Webview and javascript’s document.cookie

  android, cookies, ios, react-native

Let me explain a little bit.
I’ve developed an app with React Native which use Webview with react-native-webview and do some cookie handling with react-native-cookie.

For some GDPR reasons I have to display a web page which modify cookies, so I try to store them for later use but the cookie value never change.


let previousCookieString = '...';

const getCookieJS = 'window.ReactNativeWebView.postMessage(JSON.stringify(["cookies", document.cookie]));true;'


I know some cookies have been modified by an external script on the webpage (because I’ve tested the webpage on my browser and they had been) but the values stay the same when receiving cookies from the webview. Is the document.cookie object is editable when using WebViews ?

Event using the CookieManager from react-native-cookies they didn’t change.

Any help would be appreciated.

Thanks a lot.

Source: Android Questions