adding "pop up ads blocking" feature to a custom browser

I am designing a web browser using the microsoft web control , how can I add a "block pop up ads" feature to it ?
Who is Participating?
DarkoLordConnect With a Mentor Commented:
Hello, use this:

Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    Set ppDisp = Nothing
    Cancel = True
End Sub

Just a warning, with certain versions of Internet Explorer I have noticed that it tends to crash when you block new windows from opening like that. I would recommend giving the user a choice of enabling/disable it, just in case.

adeljadAuthor Commented:
The problem with this method is that it will block the window even when you right click on a link and choose "open in new window" .
how can I fix that ?
I don't think there is an easy way to do this...

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.