当我尝试在 native webview 中加载 https 网页时,它显示空白页面。我试图加载 http 它工作正常。但我的应用程序需要 https。请帮我解决这个问题。
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View
} from 'react-native';
import { WebView } from 'react-native';
export default class App extends Component<{}> {
render() {
return (
<WebView
source={{uri: 'https://192.168.0.80/jsxc'}} style={{marginTop: 20}}
mediaPlaybackRequiresUserAction={true}
domStorageEnabled={true}
/>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
当我尝试在 React Native WebView 中加载 https 网页时,它显示空白页面。
最佳答案
使用 uri 而不是 url。
... 来源={{uri: this.state.url}} ...
关于javascript - 当我尝试在 native webview 中加载 https 网页时,它显示空白页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47027885/