File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed
packages/webview_flutter/webview_flutter_web Expand file tree Collapse file tree 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+
15## 0.1.0+3
26
37* Minor fixes for new analysis options.
Original file line number Diff line number Diff line change 33// found in the LICENSE file.
44
55import 'dart:async' ;
6+ import 'dart:convert' ;
67import 'dart:html' ;
78import 'package:flutter/foundation.dart' ;
89import 'package:flutter/gestures.dart' ;
@@ -183,7 +184,11 @@ class WebWebViewPlatformController implements WebViewPlatformController {
183184 String ? baseUrl,
184185 }) async {
185186 // 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 ();
187192 }
188193
189194 @override
@@ -199,8 +204,11 @@ class WebWebViewPlatformController implements WebViewPlatformController {
199204 final String contentType =
200205 httpReq.getResponseHeader ('content-type' ) ?? 'text/html' ;
201206 // 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 ();
204212 }
205213
206214 @override
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: webview_flutter_web
22description : A Flutter plugin that provides a WebView widget on web.
33repository : https://github.com/flutter/plugins/tree/main/packages/webview_flutter/webview_flutter_web
44issue_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
66
77environment :
88 sdk : " >=2.14.0 <3.0.0"
You can’t perform that action at this time.
0 commit comments