Skip to content
Browse files

Expose setAllowUniversalAccessFromFileURLs in Android WebView

This pull request exposes the `setAllowUniversalAccessFromFileURLs` method of Android WebViewSettings as a property. The reason for this is when loading pages with a `file://` baseUrl it's sometimes desirable to allow loading other assets from a file base url. (For example loading an image into a canvas). More information on its use and purpose can be found [in the android docs here](

Usage example:

``` jsx
return (
    source={{ html: myhtml, baseUrl: 'file://' }}
    javaScriptEnabled={true} />
Closes #8905

Differential Revision: D4147245

Pulled By: hramos

fbshipit-source-id: 7eaa884b8c0268de52b284954a34acec0fbd4061
  • Loading branch information
Thomas101 authored and Facebook Github Bot committed Nov 8, 2016
1 parent 07295e3 commit b6a38e80e01d711205bc09348b8e005d49cebbbc
@@ -152,6 +152,14 @@ class WebView extends React.Component {
* start playing. The default value is `false`.
mediaPlaybackRequiresUserAction: PropTypes.bool,

* Boolean that sets whether JavaScript running in the context of a file
* scheme URL should be allowed to access content from any origin.
* Including accessing content from other file scheme URLs
* @platform android
allowUniversalAccessFromFileURLs: PropTypes.bool,

static defaultProps = {
@@ -227,6 +235,7 @@ class WebView extends React.Component {

return (
@@ -375,6 +375,11 @@ public void setMediaPlaybackRequiresUserAction(WebView view, boolean requires) {

@ReactProp(name = "allowUniversalAccessFromFileURLs")
public void setAllowUniversalAccessFromFileURLs(WebView view, boolean allow) {

@ReactProp(name = "injectedJavaScript")
public void setInjectedJavaScript(WebView view, @Nullable String injectedJavaScript) {
((ReactWebView) view).setInjectedJavaScript(injectedJavaScript);

0 comments on commit b6a38e8

Please sign in to comment.