Skip to content

Commit

Permalink
Fix Android 4.1-4.3 WebView source baseUrl bug
Browse files Browse the repository at this point in the history
Resolves facebook#11753. Android versions 4.1-4.3 don't understand the MIME type 'text/html; charset=utf-8' and default to 'text/plain' instead, rendering the content as an unparsed HTML string. Since the encoding is already set and passed separately, removing it from the MIME type has no negative effects.
  • Loading branch information
Etheryte committed May 4, 2017
1 parent 909fb72 commit 65aac73
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class ReactWebViewManager extends SimpleViewManager<WebView> {
protected static final String REACT_CLASS = "RCTWebView";

private static final String HTML_ENCODING = "UTF-8";
private static final String HTML_MIME_TYPE = "text/html; charset=utf-8";
private static final String HTML_MIME_TYPE = "text/html";
private static final String BRIDGE_NAME = "__REACT_WEB_VIEW_BRIDGE";

private static final String HTTP_METHOD_POST = "POST";
Expand Down Expand Up @@ -397,7 +397,7 @@ public void setMediaPlaybackRequiresUserAction(WebView view, boolean requires) {
public void setAllowUniversalAccessFromFileURLs(WebView view, boolean allow) {
view.getSettings().setAllowUniversalAccessFromFileURLs(allow);
}

@ReactProp(name = "saveFormDataDisabled")
public void setSaveFormDataDisabled(WebView view, boolean disable) {
view.getSettings().setSaveFormData(!disable);
Expand Down Expand Up @@ -491,7 +491,7 @@ public void setMixedContentMode(WebView view, @Nullable String mixedContentMode)
view.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
} else if ("compatibility".equals(mixedContentMode)) {
view.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
}
}
}
}

Expand Down

0 comments on commit 65aac73

Please sign in to comment.