TmsFncWebbrowser On Before Navigate Parms

This is my code
On windows filter the page and works perfect. On Android not filtered.

procedure TForm1.FormCreate(Sender: TObject);
begin
webb.Navigate('http://www.vanias.gr/mele.asp');
end;

procedure TForm1.webbBeforeNavigate(Sender: TObject;
  var Params: TTMSFNCCustomWebBrowserBeforeNavigateParams);
begin
Params.Cancel := Params.URL.Contains('mele.asp');

end;

You need to wait until the browser is properly initialized. You can do this from the OnFormShow event

I did exacty what you said

procedure TForm1.FormShow(Sender: TObject);
begin
webb.Navigate('https://www.vanias.gr/mele.asp');
end;

procedure TForm1.webbBeforeNavigate(Sender: TObject;
  var Params: TTMSFNCCustomWebBrowserBeforeNavigateParams);
begin
Params.Cancel := Params.URL.Contains('mele.asp');
end;

Works perfect in Windows but still in Fmx android doesnt filter the page. Have you tried and worked on android?

Hi,

We have further investigated this here and it seems that in some cases, the event is not triggered. We are currently trying to find out exactly under which circumstances.

After research on google this Always not triggered. Is it way to fix it ?

Can you share the link? we'll further investigate.

I search some months before and i found it somewhere inside this

Thanks, we'll further investigate this here as soon as possible

Hi,

We also found various articles that the event is not triggered properly. The key cause could be the page redirect. when there is no redirect happening, the page is not loaded. If a user clicks a link, or navigates to another page, then the event should be triggered. For example, this code works:

procedure TForm1.Button1Click(Sender: TObject);
begin
  TMSFNCWebBrowser1.LoadHTML('<a href="https://www.vanias.gr/mele.asp">link</a>');
end;

procedure TForm1.TMSFNCWebBrowser1BeforeNavigate(Sender: TObject;
  var Params: TTMSFNCCustomWebBrowserBeforeNavigateParams);
begin
  Params.Cancel := Params.URL.Contains('mele.asp');
end;

Click on the link inside the page, will trigger the OnBeforeNavigate.