CB-5592 Android - Add MIME type to Intent when opening file:/// URLs
To avoid the "No Activity found to handle Intent..." error.
This commit is contained in:
parent
2bd006b71e
commit
176890f305
@ -300,7 +300,12 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
try {
|
||||
Intent intent = null;
|
||||
intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(url));
|
||||
Uri uri = Uri.parse(url);
|
||||
if ("file".equals(uri.getScheme())) {
|
||||
intent.setDataAndType(uri, webView.getResourceApi().getMimeType(uri));
|
||||
} else {
|
||||
intent.setData(uri);
|
||||
}
|
||||
this.cordova.getActivity().startActivity(intent);
|
||||
return "";
|
||||
} catch (android.content.ActivityNotFoundException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user