Search code examples
wpfwpf-controlsweb-controlsawesomium

Awesomium.NET open links in default browser


I have problem with awesomium web control 1.7.4 in WPF , when the user click links in page , awesomium navigate to targetURL , but i want to open that links in system default browser.

also I want to determine mailto:jondue@example.com to open this links in default Email client.

Please help me.

Thanks

Update :

I've been doing some more searching to solve my problem, after few days I founded that when the link has a target=_blank the event ShowCreatedWebView is fired. The main problem was about links without target=_blank. After that I'm able to find links without that cause firing event RequestBringIntoView.

private void Browser_ShowCreatedWebView(object sender, Awesomium.Core.ShowCreatedWebViewEventArgs e)
    {
        System.Diagnostics.Process.Start(Browser.TargetURL.AbsoluteUri);
    }

and

private void Browser_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
    {
        if (Browser.TargetURL != new Uri("about:blank"))
        {
            System.Diagnostics.Process.Start(Browser.TargetURL.AbsoluteUri);
            e.Handled = true;
        }
    }

Solution

  • I've been doing some more searching to solve my problem, after few days I founded that when the link has a target=_blank the event ShowCreatedWebView is fired. The main problem was about links without target=_blank. After that I'm able to find links without that cause firing event RequestBringIntoView.

    private void Browser_ShowCreatedWebView(object sender, Awesomium.Core.ShowCreatedWebViewEventArgs e)
    {
        System.Diagnostics.Process.Start(Browser.TargetURL.AbsoluteUri);
    }
    

    and

    private void Browser_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
    {
        if (Browser.TargetURL != new Uri("about:blank"))
        {
            System.Diagnostics.Process.Start(Browser.TargetURL.AbsoluteUri);
            e.Handled = true;
        }
    }