-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] WebView.Source URL's are HTML encoded in Xamarin.Forms 3.0.0.482510 #2736
Comments
|
/cc @samhouts |
|
I believe the issue is caused by 14aa258#diff-1f852655bc37c1648eb2589cb1398b20R82 where the URL encoding was added for iOS devices. |
|
The same (CRITICAL) problem with FormUrlEncodedContent (iOS only; previously worked well): var p = new List>
{
new KeyValuePair("a", "b"),
new KeyValuePair("c", "https://www.google.com/search?source=hp&ei=x&q=trolo+boli&oq=trolo+boli")
};
var c = new FormUrlEncodedContent(p);
var q = c.ReadAsStringAsync().Result;
System.Diagnostics.Debug.WriteLine("var q = " + q);
var b = new UriBuilder("example.com")
{
Query = q
};
System.Diagnostics.Debug.WriteLine("var b = " + b);
Debug: var q = a=b&c=https%3A%2F%2Fwww.google.com%2Fsearch%3Fsource%3Dhp%26ei%3Dx%26q%3Dtrolo%2Bboli%26oq%3Dtrolo%2Bboli var b = http://example.com:80/?a=b&c=https%3A%2F%2Fwww.google.com%2Fsearch%3Fsource%3Dhp%26ei%3Dx%26q%3Dtrolo%2Bboli%26oq%3Dtrolo%2Bboli |
|
Even more (iOS only, previously worked well): var webview = new WebView {
... URL:
};
webview.Navigating += async (sender, args) =>
{
args.Url // will be twice url encoded, no way to use this property anymore
}
|
|
I've faced the same issue - loading mp4 videos from Azure using WebView suddenly stopped working on iOS after updating to XF 3.0. Couldn't downgrade, because I've used 3.0 new features everywhere in the app. I believe I've got working workaround for LoadUrl function issue referenced here: #2736 (comment) Create custom control: Create renderer: Use it instead of normal WebView: This is just workaround, it's a bit hacky but it works in my case. Tested on real device - Release. |
…ding crucial symbols (/,:,#,?) - Fixes xamarin#2736
…ding crucial symbols (/,:,#,?) - Fixes xamarin#2736
|
The current fix for iOS scrapes away any port passed along in the url. |
Description
When setting the
WebView.Sourceproperty on iOS, the URL is encoded. On Android it is not. This did not happen in previous versions of Xamarin.Forms and is causing a massive issue when redirecting to an Identity Server which expects a valid formatted redirect uri, thus generating an error which prevents us from logging in into our application.The attached sample demonstrates this problem by querying Google for the Microsoft website.
Steps to Reproduce
https://www.google.com/search?q=http%3A%2F%2Fmicrosoft.comExpected Behavior
The WebView should not encode the URL.
Actual Behavior
The URL is encoded again, so the
%3Ais encoded to%253A. So the actual opened page is as follows:https://www.google.com/search?q=http%3A%2F%2Fmicrosoft.comhttps://www.google.com/search?q=http%253A%252F%252Fmicrosoft.comIf you paste the URL's in your browser you can see the wanted behavior on Android, and the erroneous behavior on iOS.
Basic Information
Screenshots
Android:

iOS:

Reproduction Link
Bug.WebUriDoubleEncoding.zip
The text was updated successfully, but these errors were encountered: