Skip to content

Commit 19daf6f

Browse files
authored
Modernize the rest of the index.html files to support WASM compilation (flutter#7192)
Turns out there are a bunch of other `index.html` files that used a different method of Flutter initialization flutter#151663
1 parent 2c1f713 commit 19daf6f

File tree

13 files changed

+15
-178
lines changed

13 files changed

+15
-178
lines changed

packages/camera/camera/example/web/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
</head>
2424

2525
<body>
26-
</script>
2726
<script src="flutter_bootstrap.js" async></script>
2827
</body>
2928

packages/extension_google_sign_in_as_googleapis_auth/example/web/index.html

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,8 @@
3838
<!-- Google Sign In configuration -->
3939
<meta name="google-signin-client_id" content="[YOUR_OAUTH_2_CLIENT_ID_FOR_WEB]" />
4040
<title>Google Sign In + googleapis</title>
41-
42-
<script>
43-
// The value below is injected by flutter build, do not touch.
44-
var serviceWorkerVersion = null;
45-
</script>
46-
<!-- This script adds the flutter initialization JS code -->
47-
<script src="flutter.js" defer></script>
4841
</head>
4942
<body>
50-
<script>
51-
window.addEventListener('load', function(ev) {
52-
// Download main.dart.js
53-
_flutter.loader.loadEntrypoint({
54-
serviceWorker: {
55-
serviceWorkerVersion: serviceWorkerVersion,
56-
},
57-
onEntrypointLoaded: function(engineInitializer) {
58-
engineInitializer.initializeEngine().then(function(appRunner) {
59-
appRunner.runApp();
60-
});
61-
}
62-
});
63-
});
64-
</script>
43+
<script src="flutter_bootstrap.js" async></script>
6544
</body>
6645
</html>

packages/flutter_adaptive_scaffold/example/web/index.html

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,8 @@
3434

3535
<title>example</title>
3636
<link rel="manifest" href="manifest.json">
37-
38-
<script>
39-
// The value below is injected by flutter build, do not touch.
40-
var serviceWorkerVersion = null;
41-
</script>
42-
<!-- This script adds the flutter initialization JS code -->
43-
<script src="flutter.js" defer></script>
4437
</head>
4538
<body>
46-
<script>
47-
window.addEventListener('load', function(ev) {
48-
// Download main.dart.js
49-
_flutter.loader.loadEntrypoint({
50-
serviceWorker: {
51-
serviceWorkerVersion: serviceWorkerVersion,
52-
},
53-
onEntrypointLoaded: function(engineInitializer) {
54-
engineInitializer.initializeEngine().then(function(appRunner) {
55-
appRunner.runApp();
56-
});
57-
}
58-
});
59-
});
60-
</script>
39+
<script src="flutter_bootstrap.js" async></script>
6140
</body>
6241
</html>

packages/flutter_image/example/web/index.html

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,8 @@
3535

3636
<title>example</title>
3737
<link rel="manifest" href="manifest.json">
38-
39-
<script>
40-
// The value below is injected by flutter build, do not touch.
41-
var serviceWorkerVersion = null;
42-
</script>
43-
<!-- This script adds the flutter initialization JS code -->
44-
<script src="flutter.js" defer></script>
4538
</head>
4639
<body>
47-
<script>
48-
window.addEventListener('load', function(ev) {
49-
// Download main.dart.js
50-
_flutter.loader.loadEntrypoint({
51-
serviceWorker: {
52-
serviceWorkerVersion: serviceWorkerVersion,
53-
},
54-
onEntrypointLoaded: function(engineInitializer) {
55-
engineInitializer.initializeEngine().then(function(appRunner) {
56-
appRunner.runApp();
57-
});
58-
}
59-
});
60-
});
61-
</script>
40+
<script src="flutter_bootstrap.js" async></script>
6241
</body>
6342
</html>

packages/google_identity_services_web/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.3.1+3
2+
3+
* Updates `README.md` to reflect modern `index.html` script tag placement.
4+
15
## 0.3.1+2
26

37
* Updates web code to package `web: >=0.5.1 <2.0.0`.

packages/google_identity_services_web/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,14 @@ There are two ways to load the JS SDK in your app.
2424

2525
The most performant way is to modify your `web/index.html` file to insert a
2626
script tag [as recommended](https://developers.google.com/identity/gsi/web/guides/client-library).
27-
Place the `script` tag in the `<head>` of your site, next to the script tag that
28-
loads `flutter.js`, so the browser can downloaded both in parallel:
27+
Place the `script` tag in the `<head>` of your site:
2928

3029
<?code-excerpt "example/web/index-with-script-tag.html (script-tag)"?>
3130
```html
3231
<head>
3332
<!-- ··· -->
3433
<!-- Include the GSI SDK below -->
3534
<script src="https://accounts.google.com/gsi/client" async defer></script>
36-
<!-- This script adds the flutter initialization JS code -->
37-
<script src="flutter.js" defer></script>
3835
</head>
3936
```
4037

packages/google_identity_services_web/example/web/index-with-script-tag.html

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,12 @@
2424
<title>Authentication Example</title>
2525
<link rel="manifest" href="manifest.json">
2626

27-
<script>
28-
// The value below is injected by flutter build, do not touch.
29-
var serviceWorkerVersion = null;
30-
</script>
3127
<!--#docregion script-tag-->
3228
<!-- Include the GSI SDK below -->
3329
<script src="https://accounts.google.com/gsi/client" async defer></script>
34-
<!-- This script adds the flutter initialization JS code -->
35-
<script src="flutter.js" defer></script>
3630
</head>
3731
<!--#enddocregion script-tag-->
3832
<body>
39-
<script>
40-
window.addEventListener('load', function(ev) {
41-
// Download main.dart.js
42-
_flutter.loader.loadEntrypoint({
43-
serviceWorker: {
44-
serviceWorkerVersion: serviceWorkerVersion,
45-
},
46-
onEntrypointLoaded: function(engineInitializer) {
47-
engineInitializer.autoStart();
48-
}
49-
});
50-
});
51-
</script>
33+
<script src="flutter_bootstrap.js" async></script>
5234
</body>
5335
</html>

packages/google_identity_services_web/example/web/index.html

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,12 @@
2222
<title>Authentication Example</title>
2323
<link rel="manifest" href="manifest.json">
2424

25-
<script>
26-
// The value below is injected by flutter build, do not touch.
27-
var serviceWorkerVersion = null;
28-
</script>
2925
<!-- Trusted Types API config (disabled) -->
3026
<!-- <meta http-equiv="Content-Security-Policy" content="trusted-types;"> -->
3127
<!-- Load the GSI SDK -->
3228
<!-- <script src="https://accounts.google.com/gsi/client" async defer></script> -->
33-
<!-- This script adds the flutter initialization JS code -->
34-
<script src="flutter.js" defer></script>
3529
</head>
3630
<body>
37-
<script>
38-
window.addEventListener('load', function(ev) {
39-
// Download main.dart.js
40-
_flutter.loader.loadEntrypoint({
41-
serviceWorker: {
42-
serviceWorkerVersion: serviceWorkerVersion,
43-
},
44-
onEntrypointLoaded: function(engineInitializer) {
45-
engineInitializer.autoStart();
46-
}
47-
});
48-
});
49-
</script>
31+
<script src="flutter_bootstrap.js" async></script>
5032
</body>
5133
</html>

packages/google_identity_services_web/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: google_identity_services_web
22
description: A Dart JS-interop layer for Google Identity Services. Google's new sign-in SDK for Web that supports multiple types of credentials.
33
repository: https://github.com/flutter/packages/tree/main/packages/google_identity_services_web
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_identiy_services_web%22
5-
version: 0.3.1+2
5+
version: 0.3.1+3
66

77
environment:
88
sdk: ^3.4.0

packages/google_maps_flutter/google_maps_flutter/example/web/index.html

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,8 @@
3838

3939
<!-- This API key comes from: go/flutter-maps-web-tests-api-key (GCP project: flutter-infra) -->
4040
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAa9cRBkhuxGq3Xw3HPz8SPwaVOhRmm7kk&libraries=geometry"></script>
41-
42-
<script>
43-
// The value below is injected by flutter build, do not touch.
44-
const serviceWorkerVersion = null;
45-
</script>
46-
<!-- This script adds the flutter initialization JS code -->
47-
<script src="flutter.js" defer></script>
4841
</head>
4942
<body>
50-
<script>
51-
window.addEventListener('load', function(ev) {
52-
// Download main.dart.js
53-
_flutter.loader.loadEntrypoint({
54-
serviceWorker: {
55-
serviceWorkerVersion: serviceWorkerVersion,
56-
},
57-
onEntrypointLoaded: function(engineInitializer) {
58-
engineInitializer.initializeEngine().then(function(appRunner) {
59-
appRunner.runApp();
60-
});
61-
}
62-
});
63-
});
64-
</script>
43+
<script src="flutter_bootstrap.js" async></script>
6544
</body>
6645
</html>

packages/google_sign_in/google_sign_in/example/web/index.html

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,8 @@
77
<meta charset="UTF-8">
88
<meta name="google-signin-client_id" content="your-client_id.apps.googleusercontent.com">
99
<title>Google Sign-in Example</title>
10-
<script src="flutter.js" defer></script>
1110
</head>
1211
<body>
13-
<script>
14-
window.addEventListener('load', function(ev) {
15-
_flutter.loader.loadEntrypoint({
16-
onEntrypointLoaded: function(engineInitializer) {
17-
engineInitializer.autoStart();
18-
}
19-
});
20-
});
21-
</script>
12+
<script src="flutter_bootstrap.js" async></script>
2213
</body>
2314
</html>

packages/pointer_interceptor/pointer_interceptor_web/example/web/index.html

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,8 @@
3434

3535
<title>example</title>
3636
<link rel="manifest" href="manifest.json">
37-
38-
<!-- This script adds the flutter initialization JS code -->
39-
<script src="flutter.js" defer></script>
4037
</head>
4138
<body>
42-
<script>
43-
window.addEventListener('load', function(ev) {
44-
// Download main.dart.js
45-
_flutter.loader.loadEntrypoint({
46-
onEntrypointLoaded: async function(engineInitializer) {
47-
let appRunner = await engineInitializer.initializeEngine();
48-
appRunner.runApp();
49-
}
50-
});
51-
});
52-
</script>
39+
<script src="flutter_bootstrap.js" async></script>
5340
</body>
5441
</html>

packages/two_dimensional_scrollables/example/web/index.html

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,8 @@
3434

3535
<title>example</title>
3636
<link rel="manifest" href="manifest.json">
37-
38-
<script>
39-
// The value below is injected by flutter build, do not touch.
40-
const serviceWorkerVersion = null;
41-
</script>
42-
<!-- This script adds the flutter initialization JS code -->
43-
<script src="flutter.js" defer></script>
4437
</head>
4538
<body>
46-
<script>
47-
window.addEventListener('load', function(ev) {
48-
// Download main.dart.js
49-
_flutter.loader.loadEntrypoint({
50-
serviceWorker: {
51-
serviceWorkerVersion: serviceWorkerVersion,
52-
},
53-
onEntrypointLoaded: function(engineInitializer) {
54-
engineInitializer.initializeEngine().then(function(appRunner) {
55-
appRunner.runApp();
56-
});
57-
}
58-
});
59-
});
60-
</script>
39+
<script src="flutter_bootstrap.js" async></script>
6140
</body>
6241
</html>

0 commit comments

Comments
 (0)