Welcome Guest Search | Active Topics | Sign In | Register

How to open url in new window with ctrl + click? Options
PS
Posted: Friday, May 17, 2019 9:42:38 AM
Rank: Advanced Member
Groups: Member

Joined: 10/24/2018
Posts: 97
We've experimented a fair share with all events, etc. available on the webbrowser but we have not found a way to get the following situation to work:
1) Open the tabbed browser demo and navigate to Google
2) Search for something, it doesn't matter what
3) When opening a result with Ctrl + Click we want to open the url in a new tab
4) When opening a result with a nromal Click we want to open the url in the current tab

What do we need to do to make this possible?
eo_support
Posted: Friday, May 17, 2019 2:25:57 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
This is not possible in the current version. Sorry about it!
PS
Posted: Monday, May 20, 2019 4:10:31 AM
Rank: Advanced Member
Groups: Member

Joined: 10/24/2018
Posts: 97
When will this be possible? A lot of our users are requesting this feature as it is possible in all major browsers.
eo_support
Posted: Monday, May 20, 2019 10:33:35 AM
Rank: Administration
Groups: Administration

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

We have no plan to implement this in the near future --- please keep in mind that EO.WebBrowser is NOT meant to be another browser. Its primary goal is to allow you to integrate the Chromium browser engine into your .NET application, it is not designed for you to build another browser with it. There are a lot of very good and useful feature that Google Chrome (or other typical browsers) would have that EO.WebBrowser would not have. If we were implement all those then you would just get a clone of Google Chrome, which is neither technical possible giving that we only have limited resource, nor legally possible giving that many Google specific parts are not covered by the open source license. This is why even when these features are important from a general browser point of view, we have no plan to pursue such features.

Thanks
PS
Posted: Monday, May 20, 2019 11:17:51 AM
Rank: Advanced Member
Groups: Member

Joined: 10/24/2018
Posts: 97
Actually, the above mentioned situation was only an example, it is what we would need such that it would work in our implementation, but we do believe that we have a legit usecase for this.

We use the webbrowser control to be able to view some data that is hosted on our cloud environment and (normally) accessible via website only. There can be links embedded in topics that are available via this environment. We want to make it possible to open those links externally. One way we have managed to do so is by adding an option to the context menu, via the https://www.essentialobjects.com/doc/eo.webbrowser.contextmenuinfo.linkurl.aspx member.

However, we have no access to the this information once we catch a Ctrl + Mouseclick event. Furthermore, a ctrl + click is not accessible from within the WebView at all, it does propagate up to the BeforeNavigate or NewWindow events. And it does make sense, because ctrl + click is not meant to be handled by a single specific instance of a website/WebView, but meant to be handled by the underlying engine.

So we again hope that we can get Ctrl + Click to work such that we can open the url in another browser.
eo_support
Posted: Monday, May 20, 2019 11:35:38 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
We understand that you may have legit usercase for a feature ---- otherwise you wouldn't be asking for it. What we were trying to explain to you is that it is not possible for us to provide you everything you ever wanted. We can not just keep adding features whenever a customer have an idea. While if you look at every individual features they may all look doable, but if we were to say yes to every feature requests, we would be quickly overwhelmed and would not be able to maintain a stable product. This is the primary reason that sometimes we will not implement features that may sound very reasonable to individual customers. While our position may change in future releases, as for now we have no plan to implement this feature. So you may want to consider alternative mechanism in your application.
PS
Posted: Friday, May 24, 2019 10:29:19 AM
Rank: Advanced Member
Groups: Member

Joined: 10/24/2018
Posts: 97
That is unfortunate to hear because we cannot possibly provide a reliable alternative mechanism for Ctrl + Click, the most we can do is add an option to the context menu.
We're still hoping that support for this will become available rather sooner than later.
mose.jeziel
Posted: Monday, October 23, 2023 2:27:27 AM
Rank: Member
Groups: Member

Joined: 8/10/2023
Posts: 27
Code: C#
bool ctrlClick = false;        

private void webView1_BeforeNavigate(object sender, BeforeNavigateEventArgs e)
{
    if (ctrlClick)
    {
        e.Cancel = true;
        ctrlClick = false;
    }
}

private void webView1_MouseClick(object sender, EO.Base.UI.MouseEventArgs e)
{
    if (e.Button == EO.Base.UI.MouseButtons.Left && (ModifierKeys & Keys.Control) == Keys.Control)
    {
        ctrlClick = true;
        try
        {
            JSObject activeElement = (JSObject)webView1.EvalScript("document.activeElement");
            string url = (string)activeElement["href"];
            OpenInNewTab(url);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }
}
eo_support
Posted: Monday, October 23, 2023 9:50:01 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Thanks for sharing!


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.