I want add "open in new tab" item to the context menu. How can I do this?
I can get a link href from the DOM and open the link in new window, but in this case an OnClick event handler does not execute.
Also I can not emulate click and use BeforePopup event in my case BeforePopup event does't execute becouse my site is SPA and just use history.pushState and history.replaceState with ajax query
Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
add "open in new tab" item
- salvadordf
- Posts: 4565
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: add "open in new tab" item
Hi,
The "Open in new tab" menu option is added manually in your app, not by CEF.
In order to trigger the TChromium.OnBeforePopup event you need to modify the HTML or JS code to open that URL in a new tab.
You need to do something very similar to the PopupBrowser2 demo but using tabs instead of child forms.
As explained in the PopupBrowser2 code comments, you need to create a hidden tab with a browser. Then call TChromium.CreateClientHandler when the TChromium.OnBeforePopup event is triggered.
The OnClick event is executed only if you call TChromium.CreateClientHandler inside TChromium.OnBeforePopup.
The "Open in new tab" menu option is added manually in your app, not by CEF.
In order to trigger the TChromium.OnBeforePopup event you need to modify the HTML or JS code to open that URL in a new tab.
You need to do something very similar to the PopupBrowser2 demo but using tabs instead of child forms.
As explained in the PopupBrowser2 code comments, you need to create a hidden tab with a browser. Then call TChromium.CreateClientHandler when the TChromium.OnBeforePopup event is triggered.
The OnClick event is executed only if you call TChromium.CreateClientHandler inside TChromium.OnBeforePopup.