Open
Description
Sorry if this has been discussed before, i cannot find the subject anywhere.
webbrowser.document object what is the equivalent in Webview2 ?
Can we access the DOM like we did with webbrowser control ?
How can all of the cookies and user data be cleared when the winform program is run ?
All of the cookies and data are still in the browser from prior sessions ?
with Webbrowser control we used wininet method
public static bool SupressCookiePersist()
{
// 3 = INTERNET_SUPPRESS_COOKIE_PERSIST
// 81 = INTERNET_OPTION_SUPPRESS_BEHAVIOR
return SetOption(81, 3);
}
public static bool EndBrowserSession()
{
// 42 = INTERNET_OPTION_END_BROWSER_SESSION
return SetOption(42, null);
}
static bool SetOption(int settingCode, int? option)
{
IntPtr optionPtr = IntPtr.Zero;
int size = 0;
if (option.HasValue)
{
size = sizeof(int);
optionPtr = Marshal.AllocCoTaskMem(size);
Marshal.WriteInt32(optionPtr, option.Value);
}
bool success = InternetSetOption(0, settingCode, optionPtr, size);
if (optionPtr != IntPtr.Zero) Marshal.Release(optionPtr);
return success;
}
This does not work with Webview2, is there any way to get a fresh browser session when the program is executed ????
Any help would be appreciated.