0

I have Flutter web app which is cache by browser. I need update it.

I see can force browser download new web app if set version for main.dart.js: Stop saving in cache memory Flutter web Firebase hosting

BUT my current deployed Flutter web app have no version:

<script src="main.dart.js" type="application/javascript"></script>

So my question is: If I now add version will this method still work?

<script src="main.dart.js?version=1" type="application/javascript"></script>

Does query string method still work if previous version have no query string?

FlutterFirebase
  • 2,163
  • 6
  • 28
  • 60
  • 1
    Should do as `main.dart.js?version=1` is not equal to `main.dart.js`, and browsers cache on name. And a query string is part of the name, unlike the # tag, – Keith Dec 11 '20 at 23:08

1 Answers1

0

I used this for my project:

<script>document.write('<script src="main.dart.js?ver=' + new Date().getTime() + '"\><\/script>');</script>

instead of this:

<script src="main.dart.js" type="application/javascript"></script>
BambinoUA
  • 6,126
  • 5
  • 35
  • 51