public bool OnContextMenuCommand(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags) { // React to the first ID (show dev tools method) if (commandId == (CefMenuCommand)26501) { NewTabRequest?.Invoke(parameters.LinkUrl); return(true); } if (commandId == (CefMenuCommand)26502) { browser.GetHost().ShowDevTools(); return(true); } // React to the second ID (show dev tools method) if (commandId == (CefMenuCommand)26503) { browser.GetHost().CloseDevTools(); return(true); } // React to the third ID (Display alert message) if (commandId == (CefMenuCommand)26504) { MessageBox.Show("An example alert message ?"); return(true); } // Any new item should be handled through a new if statement // Return false should ignore the selected option of the user ! return(false); }
public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser) { //return true; //return parent.OnBeforePopup(browserControl, browser, frame, targetUrl, targetFrameName, targetDisposition, userGesture, popupFeatures, windowInfo, browserSettings, ref noJavascriptAccess, out newBrowser); newBrowser = null; NewTabRequest?.Invoke(this, new TabRequestEventArgs { URL = targetUrl }); return(true); }