Issue
I have an app that heavily uses the Android WebView
to display my custom HTML content. The latest Android update (4.4/Kit-Kat/SDK-19) featured a redesigned WebView
.
One of my users with a Nexus 5 reported a problem where some links cause the app to crash. I ran in the 4.4 emulator and debug into my WebViewClient
's shouldOverrideUrlLoading()
method. On all previously tested Android versions (2.2-4.3) the url String
passed into the method had my custom url with "/" characters in it. In 4.4 the exact same link now has "\" characters in their place.
This doesn't make any sense to me. I load the HTML exactly the same, so somehow the new WebView
converted all my slashes into backslashes.
Why does the new WebView
do this?
Solution
Changes in URL handling are a known issue. Please see the migration guide for more detail.
The behaviour in this particular case will depend on what your base URL's scheme is, from what you're describing I'm guessing your base URL's scheme is "http(s)://" in which case the Chromium WebView performs URL normalization.
You might want to consider using the URI class to handle the discrepancy between the Classic and Chromium WebViews in this case.
Answered By - marcin.kosiba
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.