-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listp: google_sign_inThe Google Sign-In pluginThe Google Sign-In pluginp: webviewThe WebView pluginThe WebView pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-webWeb applications specificallyWeb applications specifically
Description
The "data:text/html..." encoding that has to be done in the web version of webview_flutter isn't reliable enough.
2 examples of an issue caused by the current encoding
_controller.loadHtmlString("""
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<p>
This is# an example page.
</p>
</body>
</html>
""");Will only render "This is".
_controller.loadHtmlString("""
<!DOCTYPE html>
<html lang="en">
<head>
<style>
#test {
color: red;
}
</style>
</head>
<body>
<h1>Local demo page</h1>
<p class="test">
This is an example page.
</p>
</body>
</html>
""");Will not render anything.
My solution for fixing this is changing the encoding process to the one used by WebViewX.
So this: (the current encoding)
_element.src =
_element.src = Uri.dataFromString(
'data:$contentType,${Uri.encodeFull(httpReq.responseText ?? '')}';Will turn into this:
_element.src = Uri.dataFromString(
httpReq.responseText ?? '',
mimeType: contentType,
encoding: Encoding.getByName('utf-8'),
).toString();I'm currently working on a PR that does exactly that along with adding a few unimplemented features.
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listp: google_sign_inThe Google Sign-In pluginThe Google Sign-In pluginp: webviewThe WebView pluginThe WebView pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-webWeb applications specificallyWeb applications specifically