以编程方式将站点添加到 IE 弹出窗口阻止程序 (VB.NET) 的允许站点

发布于 2024-09-05 20:34:02 字数 305 浏览 3 评论 0原文

更多细节。

我需要以编程方式(Winforms、VB.NET)检查某个站点是否在 IE 弹出窗口阻止程序(IE 7 和 8 以及 Windows XP、Vista 和 7)的允许站点列表中,如果没有,则添加它。该应用程序是完全受信任的,我不想完全禁用弹出窗口阻止程序。

为了澄清一些事情,这是一个网络自动化应用程序,其多个用户分布在 3 个国家/地区。我想避免收到大量电子邮件并每次都解释如何手动将网站添加到允许的网站。

此外,一些用户安装了 Google 工具栏,其中还有一个弹出窗口阻止程序,给我的应用程序带来了麻烦。这也可以通过编程来完成吗?

A few more details.

I need to programmatically (Winforms, VB.NET) check if a site is in the Allowed Sites list of the IE Pop-Up Blocker (IE 7 and 8 and Windows XP, Vista and 7) and if not, add it. The application is fully trusted and I don't want to disable the Pop-Up blocker entirely.

To clarify some things, this is for a web-automation application with several users across 3 countries. I want to avoid receiving tons of emails and explaining each time how to add the website to the Allowed Sites manually.

Also, some of the users have Google Toolbar installed, which also has a Popup Blocker creating trouble to my app. Can this also be done programmatically?

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

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

发布评论

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

评论(1

狠疯拽 2024-09-12 20:34:02

好的,我得到了第一部分。它只是一个注册表值。

Imports Microsoft.Win32

实际代码:

Dim siteString As String = "mysite.com"
Dim emptyArray() As Byte = New Byte() {} 'Works as a Zero-Length Binary Value'
Dim subKey As String = "Software\Microsoft\Internet Explorer\New Windows\Allow"
Dim rkKey As RegistryKey = Registry.CurrentUser.OpenSubKey(subKey)

Dim value As Object = rkKey.GetValue(siteString)
If value Is Nothing Then 'Check if the value is already there'
    rkKey.SetValue(siteString, emptyArray, RegistryValueKind.Binary)
End If

它还适用于多个版本的 IE 和 Windows。

有人知道 Google 工具栏弹出窗口拦截器吗?

附注抱歉关闭单引号,但这只是让它看起来更好。

Ok, I got the first part. It's just a registry value.

Imports Microsoft.Win32

And the actual code:

Dim siteString As String = "mysite.com"
Dim emptyArray() As Byte = New Byte() {} 'Works as a Zero-Length Binary Value'
Dim subKey As String = "Software\Microsoft\Internet Explorer\New Windows\Allow"
Dim rkKey As RegistryKey = Registry.CurrentUser.OpenSubKey(subKey)

Dim value As Object = rkKey.GetValue(siteString)
If value Is Nothing Then 'Check if the value is already there'
    rkKey.SetValue(siteString, emptyArray, RegistryValueKind.Binary)
End If

It also works with multiple versions of IE and Windows.

Does anyone have any idea about the Google toolbar Popup blocker?

ps. Sorry about closing the single quotes, but it simply makes it look nicer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文