B4J Question Webview Cookies

Ivan Judd

New Member
Licensed User
Longtime User
I'm trying to use a webview in a B4J application but it only appears to be saving the cookies into memory which is a default setting going by the Java documentation rather than a file so my web application doesn't stay logged in as the cookie is lost when it closes.

I've put the following code in that let's me see that the cookies are being received plus I can run a debugger on the server and see if the cookies are being sent back from the webview.

My JavaScript also saves data into local storage, I presume that bit is working but it's tricky to tell at the moment.

I think it needs something to tell it to store the cookie in a file and possibly where that file should be. Any help appreciated before I give up and just start chrome in kiosk mode which isn't ideal!

B4X:
Dim manager As JavaObject
manager.InitializeNewInstance("java.net.CookieManager", null)
Dim handler As JavaObject
handler.InitializeStatic("java.net.CookieHandler").RunMethod("setDefault", Array(manager))
 

Ivan Judd

New Member
Licensed User
Longtime User
I've seen that post and looked into it. I had to change so much server code and JavaScript to basically replicate what every browser does out of the box I decided I was just reinventing the wheel and would end up breaking my web app so I've put it on the back burner for the time being.

Cheers.
 
Upvote 0
Top