Lecrapouille / gdcef

[Plugin][Version 0.10.0][Functional] Chromium Embedded Framework Webview for Godot 3 and 4
https://discord.gg/EckEwy7S5U
MIT License
222 stars 26 forks source link

New tab links open a new OS window #19

Open daniel-sanche opened 1 year ago

daniel-sanche commented 1 year ago

When GDCef encounters a link that tries to open a new tab, it opens these links in new window on your OS, not in the game environment

Example: Try to click on the "Visit W3Schools.com!" link on this page

I tried to look into this, and it seems like it should be possible to override this by implementing the OnBeforePopup function. So far it hasn't worked for me, but I'll try to take another look at it later (unless someone else finds the fix first)

Lecrapouille commented 1 year ago

@daniel-sanche I see what you are talking, but your link from my Firefox and for GDCEF is displayed on the same page split vertically. Do you mean a mouse click "open in a new tab" feature?

I obtain your result with https://duckduckgo.com and clicking on the blue button "add duck to your browser". When you are saying "this open a OS window". I guess simply it calls the secondary process gdcef/build/gdcefSubProcess which is a runnable browser application (edit: it used to be a browser since SHA1 e939b66ec6625c702781e1187be5f0a4123f1994 it seems no longer display).

Lecrapouille commented 1 year ago

@daniel-sanche I've done implementing a basic 2D browser https://github.com/Lecrapouille/gdcef/tree/master/addons/gdcef/demos/2D when creating a new browser tab it opens my favorite radio webpage, you then can click on the "Tune In" icon this will create the OS windows. Now we can try to fix it and implement a C++ method on_popup_created and trigger a Godot callback returning the created browser as Godot node on_popup_created(node):

daniel-sanche commented 1 year ago

Ok cool, that sounds like a good solution to me! Maybe by default it can just open the link in the current browser, if the user doesn't add the callback?

Also, when I was investigating this, it seemed to me like the CefLigfeSpanHandler functions in the GDCef Impl class weren't being called. I'm thinking maybe we need to implement GetDefaultClient() to register it as a client like in this sample?

Lecrapouille commented 1 year ago

@daniel-sanche you are certainly right! For the moment I did not investigate