Programmatically Adding a Site to IE Enabled Pop-Up Blocker Sites (VB.NET)

A few more details.

I need to programmatically (Winforms, VB.NET) check if the site is in the list of allowed sites of 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 do not want to completely disable the popup blocker.

To clarify some things, this is a web automation application with several users in three countries. I want to avoid receiving a ton of emails and explain each time how to manually add a website to allowed sites.

In addition, some users have a Google toolbar, which also has a pop-up blocker that creates problems for my application. Can this be done also programmatically?

+3
source share
1 answer

Ok, I have the first part. It is simply 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 several versions of IE and Windows.

Anyone have an idea about the Google Toolbar popup blocker?

ps. Sorry to close the single quotes, but that just makes it more enjoyable.

+4
source

Source: https://habr.com/ru/post/1750264/


All Articles