Open new tab or window wxWebView Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Anil8753
Experienced Solver
Experienced Solver
Posts: 80
Joined: Sat Jan 16, 2016 5:57 am

Open new tab or window wxWebView

Post by Anil8753 » Fri Sep 07, 2018 12:03 pm

in my HTML page, I have

Code: Select all

window.open(url,'_blank');


If I open my page in the browser and execute the above code, it opens a new tab or new window (depending on the user preference).
But I open the same page in wxWebView and execute the above code, nothing happens.

I did not find any wxWebViewEvent that is triggered when a new tab or windows is requested.

Avaialable events:

Code: Select all

wxEVT_WEBVIEW_NAVIGATING
wxEVT_WEBVIEW_NAVIGATED
wxEVT_WEBVIEW_LOADED
wxEVT_WEBVIEW_ERROR
wxEVT_WEBVIEW_NEWWINDOW
wxEVT_WEBVIEW_TITLE_CHANGED
How can I detect if new tab/window is requested by the HTML page and what is the target URL?

User avatar
doublemax
Moderator
Moderator
Posts: 13985
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Open new tab or window wxWebView

Post by doublemax » Fri Sep 07, 2018 12:23 pm

wxEVT_WEBVIEW_NEWWINDOW sounds exactly like what you're asking for. Did you try it?
Use the source, Luke!

Anil8753
Experienced Solver
Experienced Solver
Posts: 80
Joined: Sat Jan 16, 2016 5:57 am

Re: Open new tab or window wxWebView

Post by Anil8753 » Fri Sep 07, 2018 4:28 pm

Yes, you are 100% correct. wxEVT_WEBVIEW_NEWWINDOW event gets fired in this case. I do not know how it didn't work earlier. Maybe strong Beer was the reason. :P

Post Reply