网上搜索没有找到关闭React Native下webview控件的缓存的方法,经测试找到解决方案,记录如下

  • 核心思路:通过请求时设置请求头,使页面缓存过期

关键代码

<View style={styles.container}>
    <WebView source={{ uri: "http://somehost/somepath/file.html", method: 'GET', headers: { 'Cache-Control':'no-cache'} }} style={{ width: Dimensions.get('window').width, height: Dimensions.get('window').height }}></WebView>
</View>
  • 核心代码: 在source里面指定headers中的Cache-Control为no-cache

相关文章:

  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2021-10-23
  • 2021-12-18
  • 2022-12-23
  • 2021-07-08
  • 2021-11-14
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2021-07-02
  • 2021-11-24
  • 2022-12-23
相关资源
相似解决方案