Welcome Guest Search | Active Topics | Sign In | Register

EO WebBrowser webview with js's window.close methods Options
Code Instinct
Posted: Saturday, December 20, 2014 10:18:32 AM
Rank: Newbie
Groups: Member

Joined: 12/20/2014
Posts: 1
Hi Support,

I'm evaluating your EO.WebBrowser product before suggesting it to a client as a viable replacement of IE WebBrowser control.
But I've run into 2 issues:

1) When handling the webview's closed event, how do i get a reference of the Window(wpf) or Form(winforms) so that I can close that as well ?
Details:
My new webview hosts a page that has javascript which performs a window.close operation. This triggers the webview's closing and closed events but in both of these events I'm unable to get the reference of the parent container of this webview.

2) On a web application loaded in EO.WebBrowser, I have a <form> dynamically generated which performs a submit through javascript. The target of this form is set to "_blank" and the method is POST. This is handled by a newWindow event but issue occurs when I try to set the target URL to the webview (and since we cannot browse a POST, I'm stuck). Is there a way to intercept a post request and post it ourselves ?
eo_support
Posted: Saturday, December 20, 2014 4:42:48 PM
Rank: Administration
Groups: Administration

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

Thanks for posting in the forum. As to the questions:

1. You will need to get the parent form through other means. For example, in a standard Windows Form application if you have a Button and wish to handle the Button's Click event, the automatically generated event handler is already a direct member of your Form object, so inside the event handler you automatically have reference to the Form object ("this" keyword in C# or "Me" keyword in VB). If such method is not practical, you will need to remember it somewhere. For example, you can use a small event handler class like this:

Code: C#
class WebViewHandlers
{
    private Form m_Form;
    private WebView m_WebView;

    public WebViewHandlers(Form form, WebView webView)
    {
        m_Form = form;
        m_WebView = webView;
        webView.Closed += WebView_Closed;
    }

    private void WebView_Closed(object sender, EventArgs e)
    {
        m_Form.Close();
    }
}


2. Yes. It is possible for you to intercept any Url. You will need to use a custom resource handler for this purpose. Please see this link for more information on how to use custom resource handler:

http://www.essentialobjects.com/doc/6/advanced/resource_handler.aspx

Hope this helps. Please feel free to let us know if you have any more questions.

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.