|
-
Aug 19th, 2008, 08:35 PM
#1
Thread Starter
Frenzied Member
[2005] [WebBrowser Control] New Window Event?
On a WebBrowser control, was event do i have to handle so i can make all pop-ups popup in a new webbrowser control?
Can you just tell me what event must be handled? or how i would do this?
Since i am having problems with the source code links people have been giving.
-
Aug 19th, 2008, 08:47 PM
#2
Thread Starter
Frenzied Member
Re: [2005] [WebBrowser Control] New Window Event?
Here is the event i think:
vb Code:
Private Sub page_area_NewWindow(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles page_area.NewWindow
End Sub
Though when i type e. all i get is e.cancel.
I want to store the url of the link which is clicked into a variable so i can do e.cancel = true but then also open a new form with a webbrowser control with the url of the variable i made.
-
Aug 20th, 2008, 03:12 AM
#3
Re: [2005] [WebBrowser Control] New Window Event?
There are so many threads about this (I thought one was started by yourself actually but I guess you wouldnt be asking again if that was the case).
Anyway, the answer is: You cant do it just using the built in properties/events in the 2005/2008 WebBrowser control. Kleinma posted a link to some code he wrote that gets around this so you'll have to find that via the Search button.
-
Aug 20th, 2008, 10:43 AM
#4
Thread Starter
Frenzied Member
Re: [2005] [WebBrowser Control] New Window Event?
Well yes i actually did start a thread about this. I just started another one since that one was a bit old. Though anyway since i started this one i won't go back to the other one.
In the thing that Kleinma posted i had a bit of trouble with it. I will take a look at it again though.
-
Aug 20th, 2008, 12:50 PM
#5
Re: [2005] [WebBrowser Control] New Window Event?
Yeah, well just explain what problems exactly you were having and I'm sure people here can help you out. That's pretty much your only option as far as I know as like I said - it cant be done just using the standard events in the WebBrowser control
-
Aug 20th, 2008, 01:15 PM
#6
Thread Starter
Frenzied Member
Re: [2005] [WebBrowser Control] New Window Event?
The problem with the code in his class what that it had a missing file. In my old post he said to compile it, i did but yet it still doesnt work. I was able to Run the program but not view the designer. I tried to copy the code over to my program but i cant view the designer.
Why can't i handle the NewWindow event of a regular WebBrowser control?
Is there an event for mouseover a link? Since then i can make it so if the user puts there mouse over a link i can store the link as a variable then if the user clicks something i can popup a new webbrowser control with the variable i clicked...
I thought i can retrieve the link by typing e. but it doesnt work. All i can do is cancel the popup that will come in handy though.
-
Aug 20th, 2008, 01:25 PM
#7
Re: [2005] [WebBrowser Control] New Window Event?
The "missing file" you are talking about is probably from the code download in my signature, but that is not what Chris was talking about. That code uses the COM based browser control, not the managed .NET one.
The issue is that the managed browser control had to implement events and properties that are valid from IE version x to IE version x. I actually don't know what the base version it is, but its likely 5.01 or 5.5 (since .NET runs on 98). Of course the high end version right now is 7 (or 8 beta technically).
So the managed control, in order to be compliant, has been pretty crippled.
The code Chris is talking about, is actually code I wrote that extends the MANAGED browser control (does not use the COM control), and adds 2 new events, NewWindow2 and NavigateError (both are found in the COM control, but missing in the .NET control).
So using that class, you can grab new windows before they popup, and stick them into your own .NET form hosting a browser control. This will also allow popups to run in the same session as the main browser, so session state is not lost in popups.
More on it here, along with the code download:
http://zerosandtheone.com/media/p/277.aspx
-
Aug 20th, 2008, 01:26 PM
#8
Fanatic Member
Re: [2005] [WebBrowser Control] New Window Event?
I had to do this also and Kleinma helped out with it. I had to add an old Microsoft Web Browser COM object to my toolbar and use it as my browser. It requires more programming but allows you to catch popup using the New Window event.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|