Xam.Plugin.Webview icon indicating copy to clipboard operation
Xam.Plugin.Webview copied to clipboard

Cookie and Cache

Open Magic73 opened this issue 8 years ago • 6 comments

Hi :) I can't find a way to clear cookie and/or cache.

is there a way to do it programmatically?

Magic73 avatar Oct 12 '17 09:10 Magic73

Not in the abstraction currently! There is an event on each renderer called OnControlChanged which will allow you access to the native webview which you "should" be able to use to achieve this.

100% in my list of things to do though. Or you can do a PR ;) Will update this ticket to enhancement so I don't forget about it! Would there be a timescale you would need this by if you were to use this WebView?

SKLn-Rad avatar Oct 12 '17 09:10 SKLn-Rad

I've to start a new project (about 10-15 FTE). I saw that this WebView has all I need (in order to simulate tab page, I'll duplicate the control). Clearing cookie is the only enhancement that it miss for my business.

Magic73 avatar Oct 12 '17 10:10 Magic73

I started to do some check about it.. from what I saw so far, there's no way to clear cookie/cache for a single instance.

On droid, the Android.Webkit.WebView control has the IsPrivateBrowsingEnabled property that should fit perfectly.

On UWP, I can't find (for now) something similar.

Magic73 avatar Oct 12 '17 10:10 Magic73

Yeah Windows has always been the problem child which prevents me from doing a lot of these kind of enhancements... I will have a look later when I am out of the office but I think you are right

SKLn-Rad avatar Oct 12 '17 10:10 SKLn-Rad

Ok, I found it :)

On droid, just use IsPrivateBrowsingEnabled as I wrote above. On UPW, just call await Windows.UI.Xaml.Controls.WebView.ClearTemporaryWebDataAsync();

I suggest to create an async method to clear the cache/cookies with the above solutions.

Magic73 avatar Oct 12 '17 12:10 Magic73

I would like this as well. Any update on getting it added to the project?

zanesc avatar Jun 18 '18 23:06 zanesc