gpt4 book ai didi

android - 如何使 <input type =“file” > 在 Android 和 iOS 中禁用 "take photo"选项

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:08:47 26 4
gpt4 key购买 nike

我正在构建一个具有文件输入的 HTML5 页面。

<input type=“file” >

当我尝试在 iOS 或 Android 应用程序项目中使用 WebVivew 加载页面时,我想禁用输入的“拍照”选项。

有什么解决办法吗?

谢谢你们。

另外,我已经尝试过解决方案: How to disable take photo on file input iOS 6 ,但它不起作用。

最佳答案

userAngent JavaScript 中的 提供有关浏览器和操作系统的信息
navigator.userAgent 用于获取有关浏览器和操作系统的详细信息。

“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/5xx.xx ”是我们在 bowsers 控制台中运行上述命令的输出。

例子:

var userAgent = navigator.userAgent || navigator.vendor || window.opera;

//Android
if(/android/i.test(userAgent))
{
//run the android specific code
//In your case hide the Input
}

//iOS
if(/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream)
{
//run the iOS specific code
//In your case hide the Input
}

//Windows Phone
if (/windows phone/i.test(userAgent)) {
//run the Windows specific code
//In your case hide the Input
}

关于android - 如何使 &lt;input type =“file” > 在 Android 和 iOS 中禁用 "take photo"选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45346766/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com