popup blocking

  • Thread starter Thread starter anonymous
  • Start date Start date
* (e-mail address removed) scripsit:
Does anyone know where I can find some VB source for
blocking popups in IE?

Why invent things that have already been invented?
 
Here is something I came up with a few months ago on the same thing... This
is old code and I did not retest it... It lets you define a list of domain
that is okay for popups from...

Robert

Const ForReading = 1
on error resume Next
strFileName = "DomainList.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objArgs = WScript.Arguments

If objArgs.Count > 0 Then
If objFSO.FileExists(objArgs(0)) Then
strFileName = objArgs(0)
End If
End If

If objFSO.FileExists(strFileName) Then
Set objTextFile = objFSO.OpenTextFile(strFileName, ForReading)

Do While objTextFile.AtEndOfStream <> True
strNextLine = lcase(trim(objTextFile.Readline))
'Checking the length to avoid adding blank lines...
If Len(strNextLine) > 0 Then
objDictionary.Add strNextLine,strNextLine
End If
Loop
End If

For Each objItem in objDictionary
WScript.Echo "Domain : " & Trim(objDictionary.Item(objItem))
Next


Set J=CreateObject("Shell.Application")
Do
WScript.StdOut.Write Now
WScript.Sleep 900
WScript.StdOut.Write String(Len(Now),Chr(8))
For L=0 to J.windows.count-1
With J.windows.item(L)
If IsObject(J.windows.Item(L).document.frames) Then
If isObject(J.Windows.Item(L).document.frames.opener) Then
If
objDictionary.Exists(lcase(J.Windows.Item(L).Document.Domain)) Then
'WScript.Echo Now & " Popup window from protected domain " &
J.Windows.Item(L).Document.Domain
Else
WScript.Echo Now & " Closing Popup Window from " &
J.Windows.Item(L).Document.Domain
J.Windows.Item(L).document.frames.close
End If
End If
End If
End With
Next
Loop
 
Back
Top