TTMSFMXWebBrowser component and cache

Subject : TTMSFMXWebBrowser component and cache

I am using the TTMSFMXWebBrowser component on Windows.

1. The user looks at the webpage. There is one image.
2. The user changes the image.
The webpage does not change the file name for the image.
Therefore the webpage is not changed.
3. The user looks at the webpage.
The user does not see the latest image but sees the previous image.

The previous image seems to be cached. Probably because the image name
in the webpage has not changed.

If the user exits the progam, then runs the program, the user sees
the latest image.

I note that in unit 'ceflib.pas' there is in record TCefBrowser an
item reload and item reload_ignore_cache.

I note that FMX.TMSWebBrowser.Win there is TTMSFMXWinWebBrowser.Reload

Is there needed a routine TTMSFMXWinWebBrowser.Reload_Ignore_Cache?

How do I force the browser to ignore the cache?

Can I flush the cache?

Can I reload somehow?

Regards,
  Peter Evans

Hi, 


You can try by use the following code:

TChromiumFMX(TMSFMXWebBrowser1.NativeBrowser).Browser.ReloadIgnoreCache;

by adding the unit ceffmx in the uses list.

Kind Regards, 
Pieter

I tried that but unfortunately it did not work.
I saw that
  TChromiumFMX(TMSFMXWebBrowser1.NativeBrowser).Options.PageCacheDisabled was False.
So I tried:-
TChromiumFMX(TMSFMXWebBrowser1.NativeBrowser).Options.PageCacheDisabled := True;
This changed the value.
My code now is:-
TChromiumFMX(TMSFMXWebBrowser1.NativeBrowser).Options.PageCacheDisabled := True;

  TMSFMXWebBrowser1.LoadFile(WebpageStr);
  TChromiumFMX(TMSFMXWebBrowser1.NativeBrowser).Browser.ReloadIgnoreCache;

But unfortunately the above does not work either.

Hi, 


Can you perhaps try by destroying and re-creating the browser at runtime?

Kind Regards, 
Pieter

Pieter Scheldeman2015-02-04 10:50:41

I tried :-

TChromiumFMX(TMSFMXWebBrowser1.NativeBrowser).Options.ApplicationCacheDisabled := True;

Unfortunately that did not fix the problem.

I also have :-

  if Assigned(TMSFMXWebBrowser1) then begin
    TMSFMXWebBrowser1.Free;
    TMSFMXWebBrowser1 := Nil; {2015 Feb 05}
    Application.ProcessMessages;
  end;

I suspect that some interfaces are not being freed when the browser is being freed?

Can you redownload the latest version at the following URL:


http://www.tmssoftware.biz/download/ChromiumFMX.zip

I downloaded that. I checked each file for change of file date. Where the dates were different I compared my version with it. Only in one file was there a difference. That file is the one I had to change a few days back because of memory leaks.
However, I still replaced everything. I rebuilt the package etc..
Unfortunately the results of my tests are the same as before.

Do you get access violations or memory leaks when using the latest version? Alternatively you could manually remove the cache folder that is generated where the library files are located (directly inside the folder where the executable is located).

I do not get any access violations or memory leaks - that is good.
Regarding cache folder - I will now look into that solution.

I have looked into the cache folder.
Yes, a folder is created. I do not see any files in this folder though. I can not see files being created/deleted.
I have also run a program to monitor file creation and access on my system.
I am putting aside this question for 1 to 2 weeks.