0

I have a WPF application using CEFSharp and it is working perfectly well except for one small thing. If I have a link with the target=new so the link should open in a new browser window it opens fine but the window has no icon on the top left just that default "I couldn't find an icon, icon" Also is there a way to control the state of the new window i.e. maximized. Or is there a way to catch the click and perhaps force the new browser to be the users default on their system. Any suggestions appreciated

Mark Kidd
  • 1
  • 1

1 Answers1

1

Or is there a way to catch the click and perhaps force the new browser to be the users default on their system. Any suggestions appreciated

Yes, you can catch it and prevent the new window. Have a look at the IRequestHandler and ILifeSpanHandler interfaces.

internal class RequestHandler : IRequestHandler
{
    public bool OnOpenUrlFromTab(...)
    {
        Process.Start(targetUrl);
        return true; //Handled
    }

    ...
}

internal class LifeSpanHandler : ILifeSpanHandler
{
    public bool OnBeforePopup(...)
    {
        newBrowser = null;

        if (!String.IsNullOrWhiteSpace(targetUrl))
        {
            Process.Start(targetUrl);
            return true;
        }

        return false;
    }

    ...
}
Edwin
  • 733
  • 8
  • 20