Typescript: Clear the browser's cache

Created on 22 Jan 2018  ·  3Comments  ·  Source: microsoft/TypeScript

Hello,
In an Ionic project (version 3.91), I do need to clear the browser's cache, how to do that?
On google, I understood I do need to add these http headers :

  • Cache-Control : no-cache, no-store, must-revalidate
  • Pragma : no-cache
  • Expires : 0 ( or an old date, I don't understand what exactly I do have to mention)
  • Vary : *

But I still have to manually clear the browser's cache (CTRL + F5) each time I update my web project, any idea? Here you have the http headers included to my project :

let myHeaders = new Headers();
myHeaders.append('Accept', 'application/json');
myHeaders.append('Content-Type', 'application/json');
myHeaders.append('Cache-Control','no-cache, no-store, must-revalidate');
myHeaders.append('Pragma','no-cache');
//myHeaders.append('Expires','0');
myHeaders.append('Expires', 'Wed, 4 Oct 2000 07:30:00 GMT');
myHeaders.append('Vary','*');

myHeaders.append('Access-Control-Allow-Origin', '*');
myHeaders.append('Access-Control-Allow-Methods', 'POST, GET, OPTIONS');
myHeaders.append('Authorization', 'Bearer ABCDEF0123456789');

Thanks

Question

All 3 comments

You had to walk past this to get here:

<!-- If you have a QUESTION:
   THIS IS NOT A FORUM FOR QUESTIONS.
   Ask questions at http://stackoverflow.com/questions/tagged/typescript
    or https://gitter.im/Microsoft/TypeScript
-->

Look for an ionic help forum?

it's not related to ionic

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DanielRosenwasser picture DanielRosenwasser  ·  3Comments

uber5001 picture uber5001  ·  3Comments

MartynasZilinskas picture MartynasZilinskas  ·  3Comments

kyasbal-1994 picture kyasbal-1994  ·  3Comments

wmaurer picture wmaurer  ·  3Comments