2017-07-27 11 views
0

ファイルが入力されているHTML5ページを作成しています。私はiOS版やAndroidアプリのプロジェクトにWebVivewを使用してページをロードしようとしたときAndroidとiOSで<input type = "file"> "写真を撮る"オプションを無効にするには

<input type=“file” > 

は、私が入力するための「写真を撮る」オプションを無効にしたいです。

解決策はありますか?

ありがとうございます。

また、すでに解決策を試しましたが、How to disable take photo on file input iOS 6が動作しません。 JavaScriptで

+0

https://stackoverflow.com/questions/16819845/how-to-disable-take-photo-on-file-input-ios-6あなたの助けのため –

答えて

0

userAngentは、ブラウザとオペレーティングシステムに関する詳細情報を取得するために使用されているブラウザとオペレーティングシステム

navigator.userAgentについての情報を提供します。

我々は上記のコマンドを実行した場合の "Mozilla/5.0(Windows NTの10.0; Win64のx64の)のAppleWebKit/537.36(KHTML、ヤモリなど)クローム/ 59.0.3071.115サファリ/ 5xx.xx"はoutuputです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 
} 
+0

感謝。しかし、私の場合、「ギャラリーから選択」オプションを使用しても、この入力から画像を選択したいと考えています。私がしたいのは、「写真を撮る」オプションを無効にすることだけです。 –

関連する問題