473,233 Members | 1,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,233 software developers and data experts.

Keep Popup Window in WebBrowser control instead of a new window?

When using the WebBrowser control, is it possible to cause popup windows to
appear within the WebBrowser control itself instead of a new window?

This is what I've written in the NewWindow2 event, but I can't figure out
how to get the popup to appear in the same browser window.

In this code the user is presented with "Yes", "No" or "Cancel". Yes allows
the popup to spawn a window, No should load the popup in the same window and
Cancel should just not show the popup at all.

....also, is it possible to determine the URL that the popup is trying to
load, so it can be included in the MsgBox prompt?

'
'New window is wanting to be created
'
Private Sub web_NewWindow2(ppDisp As Object, Cancel As Boolean)
Dim Resp As Long 'Holds users response

'Ask user what to do with popup window
Resp = MsgBox("Allow popup to open a new window?", vbYesNoCancel,
"Window Popup")

Select Case Resp
Case vbNo 'No, keep in same window
'Set Display object to our current web browser object (Doesn't
work)
Set ppDisp = web.object

Case vbYes 'Yes, let new window open

Case vbCancel 'Cancel, don't open popup window
Cancel = True
End Select
End Sub
Jul 17 '05 #1
1 18244
I should qualify "Doesn't work"...

If I select "NO", the popup page should appear in the main browser window
instead of a popup window. What actually happens is that the main window
resizes & positions within my app (if the popup has sizing/positioning), but
the content does not load. I'd like to AVOID the resizing, but do load the
content into the main window.
"Noozer" <do*******@me.here> wrote in message
news:7dDqc.531018$oR5.157463@pd7tw3no...
When using the WebBrowser control, is it possible to cause popup windows to appear within the WebBrowser control itself instead of a new window?

This is what I've written in the NewWindow2 event, but I can't figure out
how to get the popup to appear in the same browser window.

In this code the user is presented with "Yes", "No" or "Cancel". Yes allows the popup to spawn a window, No should load the popup in the same window and Cancel should just not show the popup at all.

...also, is it possible to determine the URL that the popup is trying to
load, so it can be included in the MsgBox prompt?

'
'New window is wanting to be created
'
Private Sub web_NewWindow2(ppDisp As Object, Cancel As Boolean)
Dim Resp As Long 'Holds users response

'Ask user what to do with popup window
Resp = MsgBox("Allow popup to open a new window?", vbYesNoCancel,
"Window Popup")

Select Case Resp
Case vbNo 'No, keep in same window
'Set Display object to our current web browser object (Doesn't
work)
Set ppDisp = web.object

Case vbYes 'Yes, let new window open

Case vbCancel 'Cancel, don't open popup window
Cancel = True
End Select
End Sub

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Vetrivel | last post by:
Application architecture : Develop interface between two existing systems, a. Enterprise CRM system b. Web based intranet system. Environment : Intranet Server : IIS and ASP. Script :...
12
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank,...
1
by: Bill H | last post by:
I run a dbms application that interfaces with the web. This module creates a frames page with two frames ('main' and 'mwinfoframe'). All communication with the dbms is routed through the...
1
by: Chris LaJoie | last post by:
Hi, I have a question regarding the catching of popups in a separate window. I just can't get it to work. My browser is extremely simple and is designed for a single purpose: to open a 'netlet'...
1
by: billy | last post by:
Ok, here's the situation... I have a user control that contains two textboxes (one for a from date/time and one for a to date/time) and two image buttons. The user control itself is supposed to...
1
by: Tuong | last post by:
I have a situation where i have a form that contains a webbrowser control. With this I was able to implement an application that can browse websites. One particular website i visited opens up...
0
by: mike11d11 | last post by:
I have a tab control on my form that has a webbrowser docked in it. It automatically navigates to a website. Once the users clicks on a particular link and popup window should come up with a...
0
by: Andre Rode | last post by:
Hi, does somebody know how to redirect a popup fired by a webbrowser element to a second webbrowser? Background: I use a vb.net program to fill data into a website. At the end, all this is...
11
by: V S Rawat | last post by:
using Javascript, I am opening a web-based url in a popup window. MyWin1=Window.Open(url, "mywindow") There is a form (form1) in the url in that popup window, I need to submit that form. ...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.