When opening a new browserinstance from an existing TadvWebbrowser the url is readonly.
There are no buttons for back and home either in the new opened browser: How can I change that?
You mean, there is a popup coming when clicking on a link? This is default behavior. The new window is shown in a popup without navigation possibilities. If you want to capture popups, please use the code below, and show the new link inside the same window, or show a popup form with a new TAdvWebBrowser.
uses
AdvWebBrowser.Win;
...
implementation
...
type
TCoreWebView2NewWindowRequestedEventHandler = class(TInterfacedPersistent, ICoreWebView2NewWindowRequestedEventHandler)
public
function Invoke(sender: ICoreWebView2; args: ICoreWebView2NewWindowRequestedEventArgs): HRESULT; stdcall;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
c: ICoreWebView2Controller;
w: ICoreWebView2;
t: EventRegistrationToken;
begin
c := ICoreWebView2Controller(AdvWebBrowser1.NativeBrowser);
if Assigned(c) then
begin
if c.get_CoreWebView2(w) = S_OK then
begin
w.add_NewWindowRequested(TCoreWebView2NewWindowRequestedEventHandler.Create, @t);
end;
end;
AdvWebBrowser1.URL := 'http://office.com';
end;
{ TCoreWebView2NewWindowRequestedEventHandler }
function TCoreWebView2NewWindowRequestedEventHandler.Invoke(
sender: ICoreWebView2;
args: ICoreWebView2NewWindowRequestedEventArgs): HRESULT;
begin
args.put_NewWindow(sender);
Result := S_OK;
end;