flush the cache of browser from the platform OS

flush the cache of browser from the platform OS

  

Hi


Is there a way to flush/DELETE the cache of Internet Explorer (11) from the platform OS ? 


Jorge 

You're talking about a programmatic way of deleting the client browser cache... is that right?  I don't think you can do that these days... at least I hope not.  That would be a terrible security breach.

Hello Jorge,

You shouldn't do that (even if it is possible, what I don't think it is).

May I ask why do you need this? Possibly there are better ways to accomplish what you really need to do (the reason behind the question).

Cheers

ok. The customer required it. Reason? As you know if the cache gets inconsistent the app gets weird behavior as it happened yesterday. Only after flushing the cache of the browser (IE 11) the app returned to the normal. Some info was disappearing, or there was some data that was inconsistent (it had old values, or mixed values for no apparent reason or misbehaved actions). I told that this was unlikely to be possible (flush BROWSER cache from OS). Imagine that someone do not want to loose some information in the cache and there is an external action that put it in danger. Well, I suppose, as a good rule of thumb is good practice to delete cache from time to time. 


it is a yes for your question, David. I agree! 

Solution

Hello Jorge,

As far as I know, there is NO way to clear the Browser's cache from an application.
This is not a problem of OutSystems, it is a matter of security.

But you can tell the borwser to NOT cache the content of your pages, using META tags.

<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>

In HttpRequestHandler you have methods to add meta tags to your application.

Of course, your application will suffer big performance penalty.

Solution

@Eduardo, what about disabling or modifying cache expiration for JavaScript files only? I've run into issues previously where we make updates to JavaScript files but they are cached and begin to cause client-side errors.

I know there is a version number appended to the end of the file references but it looks like our version number is not incrementing properly. Is there a way to override the version number with a date time stamp instead?

Hello Max.

Are the JavaScript files you're talking, external files (in resources, etc)?
If so, you must remember to change the name of the file, as the browser cache works based on the file name. 

If you are changing the JavaScript in a JavaScript property of a web block or page, the version number of the file should be updating when you change it... Let me check this.

Cheers.

Thanks for the response Eduardo! 

When I click the module/project name at the very root of the interface tab, I can drill-down into Web -> JavaScript, which allows me to create a global JS file. When I run the application this JS file is named like "_OSGlobalJS.js?1526381308".

When I publish to my development environment I can see that the timestamp (I'm assuming) that's appended to the end of this JS is updated. Unfortunately when I publish my changes to the main environment I'm receiving feedback from users that this file has not updated. However when we clear the cache this file is reloaded most times.

I'd like to take more control over how this JS file is versioned, maybe even exclude it from the cache all together.

I found out that I could embed third-party JS scripts into a web block, then apply it to a common section of the app like the header. This file appears to have the same timestamp as mentioned above. I could try doing something similar instead of utilizing the global JS capabilities of the app, but it wouldn't be ideal.