Allow distinguishing user- from script-opened wxWebView windows
Add wxWebViewEvent::GetNavigationAction() returning a value that can be either wxWEBVIEW_NAV_ACTION_USER for the links opened by the user, or wxWEBVIEW_NAV_ACTION_OTHER for the other ones (e.g. opened from JavaScript code on the page). Closes #15402.
This commit is contained in:
committed by
Vadim Zeitlin
parent
91aa6ba36e
commit
b61123cd7d
@@ -828,7 +828,14 @@ void WebFrame::OnDocumentLoaded(wxWebViewEvent& evt)
|
||||
*/
|
||||
void WebFrame::OnNewWindow(wxWebViewEvent& evt)
|
||||
{
|
||||
wxLogMessage("%s", "New window; url='" + evt.GetURL() + "'");
|
||||
wxString flag = " (other)";
|
||||
|
||||
if(evt.GetNavigationAction() == wxWEBVIEW_NAV_ACTION_USER)
|
||||
{
|
||||
flag = " (user)";
|
||||
}
|
||||
|
||||
wxLogMessage("%s", "New window; url='" + evt.GetURL() + "'" + flag);
|
||||
|
||||
//If we handle new window events then just load them in this window as we
|
||||
//are a single window browser
|
||||
|
Reference in New Issue
Block a user