-
-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebView on Android displays empty page when html contains style element #2242
Comments
I can verify that I can reproduce this problem; but I have no idea what is causing it. The existence of any I thought it might be a bug caused by loading content before the web view is ready; but putting in a 2s delay before the page load doesn't fix the problem; neither does using the same content in the It's not all style tags, either. If you remove all the references to I'm at a bit of a loss to explain any of this. Have you got any ideas @mhsmith? |
As part of the Toga 0.4 work, the Android WebView stopped using base64 encoding in its
Apparently the
For now, you can work around this by %-encoding the data yourself using something like |
@mhsmith I use the data URL I use WebView.set_content, not loadUrl. |
The documentation I quoted was from the native The workaround is to wrap the
I've tried this with your example and it works fine. Though obviously you should only do it on Android, unless a similar bug happens to exist on other platforms. |
@mhsmith I will try this, many thanks! |
@mhsmith Yes, the workaround is working! Thanks again |
I'm able to confirm that the same issue is happening with my current project on Android, but not on Linux: In Linux it's working fine, but... when I launch it on Android it displays an empty page, but also, chromium said that javascript functions are not implemented.
I have put a print to verify that application is reading the code and should load it. |
FWIW: The fix here would be relatively straightforward - the Android backend needs to do the |
I cannot confirm it right now but I think your fix could work because I saw in chromium an exception with url-encoded html that I didn't put it, and it could be the reason of lost javascript, but until next days I don't touch a PC xD. When I try it I will put the results. By the way, happy new year! |
I can confirm that the problem with urllib.parse.quote(html) is fixed for Android |
Describe the bug
When displaying a html file that contains a style element (on Android) the page is not rendered and remains white.
The html file is rendered correctly with Android's HTML Viewer
The html file is rendered correctly in WebView on Windows
The html file was rendered correctly in WebView on Android with Toga 0.3.1dev93
When the style element is removed, the page is shown in WebView (but without the styles of course).
When using a separate CSS file, the html file is shwon in WebView but without the styles.
Steps to reproduce
I use this code to display the html file:
Expected behavior
The html file should be rendered correctly also with Toga 0.4.x
Screenshots
No response
Environment
help-en.html.zip
Logs
Additional context
No response
The text was updated successfully, but these errors were encountered: