简体   繁体   English

Javascript在Android的React-Native WebView中不起作用(设置了javaScriptEnabled = true)

[英]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: 无法在Android上的React-Native WebView中使用JavaScript:

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


            />
</View>

Try running on a real Android device. 尝试在真正的Android设备上运行。

  • 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 ) 在x86 Android模拟器上,我无法获得WebView来运行返回webpack(Angular)包的URL(其他网页工作正常)
  • The same URL works fine if copied to the x86 Android emulator's native web browser. 如果复制到x86 Android模拟器的本机Web浏览器,相同的URL工作正常。
    • The same URL works fine running on a WebView on a real Android Device. 相同的URL可以在真实Android设备上的WebView上正常运行。

I am not sure if anything more than javaScriptEnabled is needed. 我不确定是否需要更多的javaScriptEnabled

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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