|
10 | 10 |
|
11 | 11 | For more details:
|
12 | 12 | * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
|
| 13 | +
|
| 14 | + This is a placeholder for base href that will be replaced by the value of |
| 15 | + the `--base-href` argument provided to `flutter build`. |
13 | 16 | -->
|
14 |
| - <base href="/"> |
| 17 | + <base href="$FLUTTER_BASE_HREF"> |
15 | 18 |
|
16 | 19 | <meta charset="UTF-8">
|
17 | 20 | <meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
18 | 21 | <meta name="description" content="A new Flutter project.">
|
19 | 22 |
|
20 | 23 | <!-- iOS meta tags & icons -->
|
21 |
| - <meta name="apple-mobile-web-app-capable" content="yes"> |
| 24 | + <meta name="mobile-web-app-capable" content="yes"> |
22 | 25 | <meta name="apple-mobile-web-app-status-bar-style" content="black">
|
23 | 26 | <meta name="apple-mobile-web-app-title" content="example">
|
24 | 27 | <link rel="apple-touch-icon" href="icons/Icon-192.png">
|
25 | 28 |
|
| 29 | + <!-- Favicon --> |
| 30 | + <link rel="icon" type="image/png" href="favicon.png"/> |
| 31 | + |
26 | 32 | <title>example</title>
|
27 | 33 | <link rel="manifest" href="manifest.json">
|
28 | 34 | </head>
|
29 | 35 | <body>
|
30 |
| - <!-- This script installs service_worker.js to provide PWA functionality to |
31 |
| - application. For more information, see: |
32 |
| - https://developers.google.com/web/fundamentals/primers/service-workers --> |
33 |
| - <script> |
34 |
| - var serviceWorkerVersion = null; |
35 |
| - var scriptLoaded = false; |
36 |
| - function loadMainDartJs() { |
37 |
| - if (scriptLoaded) { |
38 |
| - return; |
39 |
| - } |
40 |
| - scriptLoaded = true; |
41 |
| - var scriptTag = document.createElement('script'); |
42 |
| - scriptTag.src = 'main.dart.js'; |
43 |
| - scriptTag.type = 'application/javascript'; |
44 |
| - document.body.append(scriptTag); |
45 |
| - } |
46 |
| - |
47 |
| - if ('serviceWorker' in navigator) { |
48 |
| - // Service workers are supported. Use them. |
49 |
| - window.addEventListener('load', function () { |
50 |
| - // Wait for registration to finish before dropping the <script> tag. |
51 |
| - // Otherwise, the browser will load the script multiple times, |
52 |
| - // potentially different versions. |
53 |
| - var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion; |
54 |
| - navigator.serviceWorker.register(serviceWorkerUrl) |
55 |
| - .then((reg) => { |
56 |
| - function waitForActivation(serviceWorker) { |
57 |
| - serviceWorker.addEventListener('statechange', () => { |
58 |
| - if (serviceWorker.state == 'activated') { |
59 |
| - console.log('Installed new service worker.'); |
60 |
| - loadMainDartJs(); |
61 |
| - } |
62 |
| - }); |
63 |
| - } |
64 |
| - if (!reg.active && (reg.installing || reg.waiting)) { |
65 |
| - // No active web worker and we have installed or are installing |
66 |
| - // one for the first time. Simply wait for it to activate. |
67 |
| - waitForActivation(reg.installing ?? reg.waiting); |
68 |
| - } else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) { |
69 |
| - // When the app updates the serviceWorkerVersion changes, so we |
70 |
| - // need to ask the service worker to update. |
71 |
| - console.log('New service worker available.'); |
72 |
| - reg.update(); |
73 |
| - waitForActivation(reg.installing); |
74 |
| - } else { |
75 |
| - // Existing service worker is still good. |
76 |
| - console.log('Loading app from service worker.'); |
77 |
| - loadMainDartJs(); |
78 |
| - } |
79 |
| - }); |
80 |
| - |
81 |
| - // If service worker doesn't succeed in a reasonable amount of time, |
82 |
| - // fallback to plaint <script> tag. |
83 |
| - setTimeout(() => { |
84 |
| - if (!scriptLoaded) { |
85 |
| - console.warn( |
86 |
| - 'Failed to load app from service worker. Falling back to plain <script> tag.', |
87 |
| - ); |
88 |
| - loadMainDartJs(); |
89 |
| - } |
90 |
| - }, 4000); |
91 |
| - }); |
92 |
| - } else { |
93 |
| - // Service workers not supported. Just drop the <script> tag. |
94 |
| - loadMainDartJs(); |
95 |
| - } |
96 |
| - </script> |
| 36 | + <script src="flutter_bootstrap.js" async></script> |
97 | 37 | </body>
|
98 | 38 | </html>
|
0 commit comments