When browsing Google Maps using the "TTMSFNSWebBrowser" URL doesn't get updated. To be specific with any other Web Browser when I go to Google Maps and then for instance change a location or switch to satellite view URL is updated in real time to reflect this change, with "TTMSFNSWebBrowser" this doesn't happen, no event is generated and URL is not updated unless I call a refresh command or go to another link and then back then the correct URL is updated and shown, so on internal level somewhere this information is stored correctly but it doesn't show in real time like with other browsers.
Now I really like to save a location when browsing, with TTMSFNSWebBrowser I have to go to that location then do refresh command and only then I can retrieve and save that URL, this really bugs me.
Hi,
We'll have to investigate what is possible for a cross-platform solution. If you are targeting Windows we have added a new set of API functions that will allow you to do like the code below: The next version will have this included.
unit Unit13;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.TMSFNCTypes, FMX.TMSFNCUtils, FMX.TMSFNCGraphics, FMX.TMSFNCGraphicsTypes,
FMX.TMSFNCCustomControl, FMX.TMSFNCWebBrowser, FMX.Controls.Presentation,
FMX.StdCtrls;
type
TForm13 = class(TForm)
TMSFNCWebBrowser1: TTMSFNCWebBrowser;
Button1: TButton;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form13: TForm13;
implementation
{$R *.fmx}
uses
FMX.TMSFNCWebBrowser.Win;
type
TCoreWebView2SourceChangedEventHandler = class(TInterfacedObject, ICoreWebView2SourceChangedEventHandler)
public
function Invoke(sender: ICoreWebView2; args: ICoreWebView2SourceChangedEventArgs): HRESULT; stdcall;
end;
procedure TForm13.FormCreate(Sender: TObject);
var
c: ICoreWebView2Controller;
w: ICoreWebView2;
p: EventRegistrationToken;
begin
c := ICoreWebView2Controller(TMSFNCWebBrowser1.NativeBrowser);
c.get_CoreWebView2(w);
w.add_SourceChanged(TCoreWebView2SourceChangedEventHandler.Create, @p)
end;
{ TCoreWebView2SourceChangedEventHandler }
function TCoreWebView2SourceChangedEventHandler.Invoke(sender: ICoreWebView2;
args: ICoreWebView2SourceChangedEventArgs): HRESULT;
var
s: string;
begin
Result := S_OK;
if sender.get_Source(@s) = S_OK then
begin
TTMSFNCUtils.Log(s);
end;
end;
end.
Well I'll just have to wait then, for now refreshing the Google map page does give me the correct URL.