简体   繁体   中英

Javascript is not working in React-Native WebView for Android (javaScriptEnabled = true is set)

Can't get JavaScript working in React-Native WebView on Android:

<View style={[styles.flex]}>
            <WebView
                style={[styles.flex]}
                source={{uri: 'http://partners.zeew.eu/'}}
                javaScriptEnabled={true}


            />
</View>

Try running on a real Android device.

  • On an x86 Android emulator, I can NOT get a WebView to run a URL that returns a webpack ( Angular ) bundle ( Other web pages work fine )
  • The same URL works fine if copied to the x86 Android emulator's native web browser.
    • The same URL works fine running on a WebView on a real Android Device.

I am not sure if anything more than javaScriptEnabled is needed.

  render() { return ( <WebView source={{ uri: this.props.uri }} style={{ marginTop: 0 }} scalesPageToFit javaScriptEnabled domStorageEnabled startInLoadingState mixedContentMode="always" /> ); } 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM