Skip to content

Commit

Permalink
Fix webview crash when trying to display local html files
Browse files Browse the repository at this point in the history
Summary:
When using webview on android and trying to link to an html file located on device (using `file://`), the application would crash with an error specifying that nothing handles the fired intent. This is due to [`33a1f28`](33a1f28) which attempts to intercept all non `http(s)` links.

This is a simple fix so hopefully it can make it into the next stable release.
Closes #9668

Differential Revision: D3956485

fbshipit-source-id: 5a752abc21802a44e3a26e88669ccb6852076992
  • Loading branch information
andy9775 authored and Facebook Github Bot committed Oct 1, 2016
1 parent 1a9853d commit a2aab62
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -118,7 +118,8 @@ public void onPageStarted(WebView webView, String url, Bitmap favicon) {

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.startsWith("http://") || url.startsWith("https://")) {
if (url.startsWith("http://") || url.startsWith("https://") ||
url.startsWith("file://")) {
return false;
} else {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
Expand Down

0 comments on commit a2aab62

Please sign in to comment.