Page 1 of 1

Open new tab or window wxWebView

Posted: Fri Sep 07, 2018 12:03 pm
by Anil8753
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?

Re: Open new tab or window wxWebView

Posted: Fri Sep 07, 2018 12:23 pm
by doublemax
wxEVT_WEBVIEW_NEWWINDOW sounds exactly like what you're asking for. Did you try it?

Re: Open new tab or window wxWebView

Posted: Fri Sep 07, 2018 4:28 pm
by Anil8753
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