File tree 3 files changed +16
-4
lines changed
packages/webview_flutter/webview_flutter_web 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change
1
+ ## 0.1.0+4
2
+
3
+ * Fixes unreliable encoding of HTML to the iframe element.
4
+
1
5
## 0.1.0+3
2
6
3
7
* Minor fixes for new analysis options.
Original file line number Diff line number Diff line change 3
3
// found in the LICENSE file.
4
4
5
5
import 'dart:async' ;
6
+ import 'dart:convert' ;
6
7
import 'dart:html' ;
7
8
import 'package:flutter/foundation.dart' ;
8
9
import 'package:flutter/gestures.dart' ;
@@ -183,7 +184,11 @@ class WebWebViewPlatformController implements WebViewPlatformController {
183
184
String ? baseUrl,
184
185
}) async {
185
186
// ignore: unsafe_html
186
- _element.src = 'data:text/html,${Uri .encodeFull (html )}' ;
187
+ _element.src = Uri .dataFromString (
188
+ html,
189
+ mimeType: 'text/html' ,
190
+ encoding: Encoding .getByName ('utf-8' ),
191
+ ).toString ();
187
192
}
188
193
189
194
@override
@@ -199,8 +204,11 @@ class WebWebViewPlatformController implements WebViewPlatformController {
199
204
final String contentType =
200
205
httpReq.getResponseHeader ('content-type' ) ?? 'text/html' ;
201
206
// ignore: unsafe_html
202
- _element.src =
203
- 'data:$contentType ,${Uri .encodeFull (httpReq .responseText ?? '' )}' ;
207
+ _element.src = Uri .dataFromString (
208
+ httpReq.responseText ?? '' ,
209
+ mimeType: contentType,
210
+ encoding: Encoding .getByName ('utf-8' ),
211
+ ).toString ();
204
212
}
205
213
206
214
@override
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: webview_flutter_web
2
2
description : A Flutter plugin that provides a WebView widget on web.
3
3
repository : https://github.com/flutter/plugins/tree/main/packages/webview_flutter/webview_flutter_web
4
4
issue_tracker : https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
5
- version : 0.1.0+3
5
+ version : 0.1.0+4
6
6
7
7
environment :
8
8
sdk : " >=2.14.0 <3.0.0"
You can’t perform that action at this time.
0 commit comments