Results 1 to 5 of 5

Thread: Popup screens in WebBrowser control

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    Brossard, Québec, Canada
    Posts
    241
    I am using the WebBrowser control and would like to know how to avoid popup SCREENS. Or I kill them when they appear, or they doesn`t appear at all. Both would be fine

    Any help?

  2. #2
    Guest
    This will make it so no popup windows will open.

    Code:
    Private Sub webbrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    Cancel = True
    End Sub
    This will open popup windows using your program and not IE.

    Code:
    Private Sub webbrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    Dim F As New Form1
    Set ppDisp = F.webbrowser1.object
    F.Show
    End Sub

  3. #3
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Question URL please.

    Hi.

    Does anyone know of a URL that produces a "Popup Window" when navigated to so that I can see Matthew's code in action?

    Thanks.

  4. #4
    Guest
    http://www.aol.com has a popup window.

    Or you could make your own and view it like Webbrowser1.Navigate "C:\popup.htm"

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    function popupwin(){
    windowpopup=window.open("",'popup','toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,resizable=1,width=420,height=420');
    windowpopup.document.writeln("<head><title>Homepage</title></head><body bgcolor='black' text=white>"); 
    windowpopup.document.writeln("<h2><center>Welcome to The Homepage!</h2>");
    windowpopup.document.writeln('<h3><center>Check out some cool VB Sites:<BR></center></h3>');
    windowpopup.document.writeln('<a href=http://www.vb-world.net/ target=new>');
    windowpopup.document.writeln('VB-World.net');
    windowpopup.document.writeln('</a><BR>');
    windowpopup.document.writeln('<a href=http://www.vbcode.com/ target=new>');
    windowpopup.document.writeln('Vbcode.com');
    windowpopup.document.writeln('</a><BR>');
    </SCRIPT>
    
    <html>
    <body onLoad="popupwin()">
    </html>
    [Edited by Matthew Gates on 07-15-2000 at 11:36 PM]

  5. #5
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Matthew, follow-up please.

    Hi.

    Matthew I used the code you posted:
    Private Sub webbrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    Cancel = True
    End Sub
    It worked, but it also caused something weird to happen. Now, when I navigate to http://www.aol.com using Internet Explorer, no pop-up window comes up. Even if I navigate to it using the webbrowser control, without putting in the above code, no pop-up window comes up. Can you, or anyone else interested, look into this and tell me what you think?

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width