MicrosoftEdge / MicrosoftEdge/WebView2Feedback
Coming from Webbrowser , Winforms DOM Document Access in Webview2 Clearing of Cookies Inprivate
@Lakshmisha-KS is already working on this.
Since Feb 12, 2025.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.