javascript - 当我尝试在 native webview 中加载 https 网页时,它显示空白页面

标签 javascript android ios react-native

当我尝试在 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/

相关文章:

Javascript 确认对话框

javascript - 如何使图像停留在鼠标悬停在它自己的位置

android - 如何在用户单击时关闭通知

ios - 在 Swift 中从 ATR 确定卡号

javascript - WAMP 上的 PHP 更喜欢相同的随机数组元素?

JavaScript - `document.head.appendChild` src 和 href 中缺少请求 cookie

ios - 导航栏动画。为什么。诡异的

ios - 复制和粘贴有时不会出现在我的 UITextView 中

android - 点击后 View 消失,如何解决?

android - 执行doInBackground()时出现java.lang.RuntimeException错误如何解决?