Simple HTML that works in WebView 71 shows as blank using WebView Beta 72
Reported by
lquinn@blackberry.com,
Dec 17
|
||
Issue description
Device name: BlackBerry KEY2 LE
Android version: 8.1.0
WebView version: Chrome Beta 72.0.3626.14
Application: Simple test app
Application version: 1.0
Steps to reproduce:
(1) Run the attached APK with the WebView implementation set to Chrome Beta 72.0.3626.14.
(2) Run the attached APK with the WebView implementation set to Chrome 71.0.3578.98.
Expected result:
I would expect them to display the same.
Actual result:
With Chrome Beta 72.0.3626.14 as the WebView implementation, the WebView displays blank.
Here is the HTML, loaded using WebView.loadData():
<html><head><title>test</title><style>html { background-color: #313537; color: #FFFFFF }</style></head><body><p>Hello World!</p></body></html>
,
Dec 17
How are you encoding the data you pass into loadData? We've recently fixed an issue with parsing data: URLs that allowed # to be part of the content, instead of a fragment identifier (see issue 123004). If you aren't URL encoding the # signs in your payload they will be interpreted as the end of the data and beginning of a fragment identifier. You must either URL encode the data, base64 encode the data and specify "base64" as the encoding, or use loadDataWithBaseURL with a non-data: base URL (which causes the data to be interpreted literally for... some reason)
,
Dec 17
lquinn@, Thank you for your report. We will check and update the bug.
,
Dec 17
Ah, that would be our fault for not reading the WebView.loadData() API documentation closely enough. We were not encoding the data at all. URL-encoding it fixes the issue.
,
Dec 17
Generally we recommend using loadDataWithBaseURL and using a real base URL instead of leaving it as a data: URL; this both avoids the encoding issue and means you have a real origin for your document. loadData is fine as long as you give the data in the right form, though - we inadvertently let apps "get away with" not quite encoding it right for a long time, and only fixed it recently after our stats showed there wasn't actually a lot of this particular incorrect usage in practise. I'll close the bug. |
||
►
Sign in to add a comment |
||
Comment 1 by gov...@chromium.org
, Dec 17