Inject cookie into chromium Android

181 views
Skip to first unread message

Deepak Bharti

unread,
Jul 12, 2023, 8:14:14 AM7/12/23
to Chromium-dev
Hi All,
I have a requirement to inject cookie value to the webpage displayed in chromium browser android.

Can anyone suggest what is he way we can inject cookie to the chromium WebView?



Thanks:
Deepak

Torne (Richard Coles)

unread,
Jul 12, 2023, 12:02:00 PM7/12/23
to ts-deepa...@rakuten.com, Chromium-dev
Are you talking about an app that you've created which uses android.webkit.WebView to show web content, or the Chrome browser, or something else?

If you're using WebView in your own app then you can use https://developer.android.com/reference/android/webkit/CookieManager to read and write cookies from WebView's cookie jar.

If you're talking about the actual Chrome browser then it's not possible to access or modify its cookies (or other data) from outside the browser.

 


Thanks:
Deepak

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/b7c5bb01-ecb7-45cb-9a69-a9a63960d83bn%40chromium.org.

Deepak Bharti

unread,
Jul 12, 2023, 1:02:04 PM7/12/23
to Chromium-dev, Torne (Richard Coles), Chromium-dev, ts-deepa...@rakuten.com
Thanks for the response.

I have an Android Browser app on top of chromium Android browser, and I need to inject cookie into the browser app whenever any webpage is getting loaded. 

Actual requirement is to inject cookie within the browser from browser itself.
We are using chromium version of 106.0.5249.65

Let me know in case its not clear.

Torne (Richard Coles)

unread,
Jul 12, 2023, 1:08:15 PM7/12/23
to ts-deepa...@rakuten.com, Chromium-dev
On Wed, 12 Jul 2023 at 13:02, 'Deepak Bharti' via Chromium-dev <chromi...@chromium.org> wrote:
Thanks for the response.

I have an Android Browser app on top of chromium Android browser, and I need to inject cookie into the browser app whenever any webpage is getting loaded. 

Ah. If you are just building your own Chromium browser for Android then there is no WebView involved - the browser does not use WebView.

I don't know how you can manipulate the cookie jar from the browser code, but you might start by looking at the content settings code - that can show the user the cookies and allow deleting them/etc, so may give you a pointer?
 
Reply all
Reply to author
Forward
0 new messages