Jump to content

cache


jahlxx

Recommended Posts

Hi.

 

Is there any way to not use the browser cache?.

 

I have a help files in html, loaded in a uniurlframe.

 

when I change one help file, the users can't view the new version, until not clear the browser cache.

 

 

thanks.

 

Link to comment
Share on other sites

I have a help files in html, loaded in a uniurlframe.

 

when I change one help file, the users can't view the new version, until not clear the browser cache.

 

Hi,

 

Can you try this?!:

 

for example:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniURLFrame1.URL := 'files/test.html?' + FormatDateTime('ddmmyyyyhhmmss', Now)
end;

Best regards.

  • Upvote 2
Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...
7 minutes ago, jahlxx said:

When the link is from other html file, don't work.

I mean that I show a html page in a urlframe. In that page, there is a link to other html page, but allways shows the same, not the modifications until clear the cache.

Hi,

How can we reproduce?

Link to comment
Share on other sites

Here it is.

 

Press button, and it will load index.html.

Inside index.html, click, test link, and will load second.html.

Exit application.

Modify second html.

Run application again, press button and click the link, and you will see that open the older second.html.

I hope this help.

Thanks.

test.zip

Link to comment
Share on other sites

56 minutes ago, jahlxx said:

Have you seen the test case?

Hi,

Sorry for the late reply.

Try to analyze and try to use this approach...

procedure TMainForm.htcontFrameLoaded(Sender: TObject);
begin
  UniSession.AddJS(
    'try {MainForm.htcont.iframe.contentDocument.querySelector(''a[href*="second.html"]'').href=MainForm.htcont.iframe.contentDocument.querySelector(''a[href*="second.html"]'').href+"?dt="+Date.now()} catch(err){}'
  );
end;

 

Link to comment
Share on other sites

  • 2 years later...

How to prevent caching of files loaded loaded by list ServerModule.CustomFiles

for example files/main.js
I can write files/main.js?v1 but I want to automate the process

.....

sorry, the decision is obvious

procedure TUniServerModule.UniGUIServerModuleBeforeInit(Sender: TObject);
var
  FileName, Update: string;

begin
  FileName:=FilesFolderPath+'main.js';
  Update:=IntToStr(FileAge(FileName));
  CustomFiles.Add('app/files/main.js?v'+Update);

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...