dport 0 Posted June 8, 2022 (edited) Delphi 11.1 on Android WebBrowser content disappears when parent is changed Add a WebBowser, GroupBox and three Button component on a form. Write this code to add a text to WebBrowser with EvaluateJavaScript method. procedure TForm1.Button1Click(Sender: TObject); begin webbrowser1.EvaluateJavaScript('document.write("hello");') end; procedure TForm1.Button1Click(Sender: TObject); begin webbrowser1.EvaluateJavaScript('document.write("hello");') end; And add this code to change WebBrowser Parent to groupbox1 procedure TForm1.Button2Click(Sender: TObject); begin webbrowser1.Parent :=groupbox1; end; And add this code to change WebBrowser Parent to form1. procedure TForm1.Button3Click(Sender: TObject); begin webbrowser1.Parent :=form1; end; Run on android and press Button1 to add Hello to WebBrowser1 And Click Button2 to change WebBrowser parent to groupbox1 And Click Button3 to change WebBrowser parent to form Webbowser content lost. https://quality.embarcadero.com/browse/RSP-38439? I found a difference with delphi 10.4 fmx.webbrowser.pas. Embarcadero added this code to delphi 11 fmx.webbrowser.pas. procedure TCustomWebBrowser.DoRootChanged; begin inherited; if csDesigning in ComponentState then Exit; if Root <> nil then RecreateWebBrowser; end; procedure TCustomWebBrowser.DoRootChanging(const NewRoot: IRoot); var WBService : IFMXWBService; begin inherited; if csDesigning in ComponentState then Exit; if (FWeb <> nil) and TPlatformServices.Current.SupportsPlatformService(IFMXWBService, WBService) then begin WBService.DestroyWebBrowser(FWeb); FWeb := nil; FWindowsBrowserProperties := nil; end; end; When parent change they destroy and recraete it. Why? Edited June 9, 2022 by dport found problem Share this post Link to post