Dro*_*dme 5 android webview hybrid-mobile-app react-native
我在我的应用程序中使用 React Native WebViw。我想禁用文件下载。大多只是文件。我无法禁用存储权限,因为应用程序中的某些功能需要此功能。
您可以通过注入 JavaScript 来实现此目的,并借助 controlList="nodownload" 属性检查以下视频文件的参考代码:
<WebView
style={{
height: this.props.videoPlayerHeight,
width: this.props.videoPlayerWidth,
backgroundColor: 'black',
}}
allowsFullscreenVideo={true}
allowFileAccess={false}
mixedContentMode="always"
mediaPlaybackRequiresUserAction={true}
injectedJavaScript={`document.getElementsByTagName("video")[0].controlsList="nodownload";`}
source={{uri: `${this.props.videoLink}#t=0.01`}}
startInLoadingState={true}
renderLoading={this.renderLoading}
/>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5558 次 |
| 最近记录: |