Welcome Guest Search | Active Topics | Sign In | Register

Application gets hanged when we handle New window event Options
Tank
Posted: Wednesday, February 4, 2015 5:57:29 AM
Rank: Advanced Member
Groups: Member

Joined: 6/13/2014
Posts: 38
Hi All,

I am trying to open google.com url in New window even, please refer below my implementation.



Here google is getting opened in browser, but my original application is getting hanged.
Please tell me where I am going wrong.
NOTE: I want to open google url in new browser(IE,Firefox) apart from main application.
eo_support
Posted: Wednesday, February 4, 2015 11:05:44 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

It will hang for sure with your code. The key step that you missed is you MUST display the new WebView passed to you through the event argument. When a new window is needed, the following sequence of events occurs:

1. The browser engine creates a new WebView object;
2. It passes this WebView to you through NewWindow event;
3. You display e.WebView somehow. For example, the following code display the new WebView in a new form:

Code: C#
//Create a new form and a new WebControl
Form form = new Form();
EO.WebBrowser.WebControl webControl = new EO.WebBrowser.WebControl();
webControl.Dock = DockStyle.Fill;
form.Controls.Add(webControl);

//!!important!! Place the new WebView passed to you
//into the WebControl.
webControl.WebView = e.WebView;

//You must also display the form. This triggers the 
//initialization of the WebView. An invisible WebView
//will not be initialization
form.Show();

4. Set e.Accepted to true to indicate that you did accept and display e.WebView;

5. The browser engine waits for the new WebView to initialize;

6. The browser engine loads the target into the new WebView;

If you skip both step 3 and step 4, then the browser engine will skip step 5 and 6 (because you didn't set e.Accepted to true) and the new window will not be displayed, this works effectively as a popup blocker.

If you skip step 3 only (which is your case), then the browser engine will think you have already made all the necessary arrangement to display e.WebView. So it will wait on step 5. However since you didn't do anything with e.WebView, this new WebView will never get a chance to initialize. Thus you will be deadlocked on step 5.

Hope this clears it up for you. Please feel free to let us know if you still have any questions.

Thanks!
Tank
Posted: Thursday, February 5, 2015 12:22:15 AM
Rank: Advanced Member
Groups: Member

Joined: 6/13/2014
Posts: 38
Hello Team,
Thanks for your quick reply. It's clear that what is happening in my case. But I don't want to open the url in the form with EO. I want to open it in user's default browsers i.e. IE,firefox etc but not in EO.
At the same time I don't want user to loose control over newly opened browser (which we will be opening from new window event) as well as on main EO application.
eo_support
Posted: Thursday, February 5, 2015 10:09:20 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

That is not possible. EO.WebBrowser engine can not talk to another browser window from another browser. It can only talk to window created by EO.WebBrowser. You either open the new window from EO and get access to the new window from your original window; Or ignore it (by not setting e.Accepted to true) and do whatever you want --- but you won't be able to have access to the new window from the original EO.WebBrowser window. In the second case, EO.WebBrowser considers the new window fails to open.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.