如何在 WebBrowser 控件中启用 inPrivate 模式

发布于 2024-11-25 03:00:23 字数 222 浏览 5 评论 0原文

我必须制作一个带有一些额外功能的 IE 类型浏览器。

在 Visual Studio 中,我们有一个名为“WebBrowser”的组件,它使用用户电脑中安装的当前 IE 浏览器。

但是,我无法找到任何允许访问我希望通过控件公开的 InPrivate 模式的属性。

有没有办法将 InPrivate 模式与 WebBrowser 控件一起使用,或者我必须制作自己的浏览器来支持此功能?

I have to make a IE type browser with some extra features on it.

In Visual Studio, we have a component named "WebBrowser" that uses current IE browser installed in user's pc.

However, I am unable to find any property that enables access to the InPrivate mode I hoped would be exposed by control.

Is there a way to use InPrivate mode with the WebBrowser control, or would I have to make my own browser that supports this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

热鲨 2024-12-02 03:00:23

根据 EricLaw 的回答 相关问题,听起来这可能是不可能的。

您可能会陷入自己的控制或寻找替代控制的困境。

According to EricLaw's answers on a related question, it sounds like this might not be possible.

You might be stuck making your own control or looking for an alternative one.

那些过往 2024-12-02 03:00:23

下面是一些可以让您访问 InPrivate IE 的代码

Friend Function Open(Optional ByVal Url As String = "about:blank", Optional ByVal WindowState As ProcessWindowStyle = ProcessWindowStyle.Hidden) As WebBrowser
On Error Resume Next

Dim Start As New ProcessStartInfo
Dim Windows = New ShellWindowsClass
Dim Count = Windows.Count
Start.FileName = "iexplore.exe"
Start.Arguments = "-private -nomerge " & Url
If WindowState = ProcessWindowStyle.Hidden Then
  Start.WindowStyle = ProcessWindowStyle.Minimized
Else
  Start.WindowStyle = WindowState
End If
Process.Start(Start)

'Wait is my own class that waits for 10 secs
Wait.Reset()
Do
  If Windows.Count > Count Then Exit Do
Loop While Wait.Waiting

Browser = Windows(Count)
Browser.Visible = (WindowState <> ProcessWindowStyle.Hidden)
Return Browser
End Function

Here's some code that will give you access to an InPrivate IE

Friend Function Open(Optional ByVal Url As String = "about:blank", Optional ByVal WindowState As ProcessWindowStyle = ProcessWindowStyle.Hidden) As WebBrowser
On Error Resume Next

Dim Start As New ProcessStartInfo
Dim Windows = New ShellWindowsClass
Dim Count = Windows.Count
Start.FileName = "iexplore.exe"
Start.Arguments = "-private -nomerge " & Url
If WindowState = ProcessWindowStyle.Hidden Then
  Start.WindowStyle = ProcessWindowStyle.Minimized
Else
  Start.WindowStyle = WindowState
End If
Process.Start(Start)

'Wait is my own class that waits for 10 secs
Wait.Reset()
Do
  If Windows.Count > Count Then Exit Do
Loop While Wait.Waiting

Browser = Windows(Count)
Browser.Visible = (WindowState <> ProcessWindowStyle.Hidden)
Return Browser
End Function
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文