WebView的使用總結(jié)

WebView是android常見(jiàn)的一個(gè)組件,隨著混合開(kāi)發(fā)的發(fā)展,越來(lái)越多的公司使用原生和h5共同開(kāi)發(fā)。所以使用WebView的頻率越來(lái)越高了,所以想做次總結(jié)

<a name="t0" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>WebView的常見(jiàn)用法

<a name="t1" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>最簡(jiǎn)單的用法

<a name="t2" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>loadUrl

loadUrl(String url);

加載一個(gè)網(wǎng)頁(yè),其中注意的是

1. 需要加入聯(lián)網(wǎng)權(quán)限,

2. 還有網(wǎng)址必須完整即以http://或者ftp://等協(xié)議開(kāi)頭,不能省略!不然將加載不出來(lái),

3. assert中的html文件。前綴換成file:///android_asset/

4. 加載sd卡中的html文件,前綴換成content://

<uses-permission android:name="android.permission.INTERNET" /> 

<a name="t3" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>loadData

public void loadData(String data, String mimeType, String encoding)

加載代碼塊。其中對(duì)于data可以采用encode一下再加載,速度快點(diǎn)

<a name="t4" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>loadDataWithBaseURL

public void loadDataWithBaseURL(String baseUrl, String data,String mimeType, String encoding, String historyUrl)

相對(duì)于loadData,其實(shí)就是一個(gè)相對(duì)路徑和絕對(duì)路徑的問(wèn)題,loadData要求必須是絕對(duì)路徑,而loadDataWithBaseURL則可以是相對(duì)路徑。historyUrl可以為null。


<a name="t5" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>WebSettings的常見(jiàn)配置

如果我們需要設(shè)置WebView的屬性,是通過(guò)WebView.getSettings()獲取取設(shè)置WebView的WebSettings對(duì)象,然后調(diào)用WebSettings中的方法來(lái)實(shí)現(xiàn)的配置一些屬性,來(lái)幫我們實(shí)現(xiàn)一些常見(jiàn)的基本操作。比如字體大小,支持縮放等

//---------------------------------------------------
// 縮放
// 1 設(shè)置支持縮放,默認(rèn)true
setSupportZoom(boolean support)

// 2 設(shè)置顯示縮放的組件 默認(rèn)true
setDisplayZoomControls(boolean enabled)  

// 3 設(shè)置是否使用縮放的內(nèi)置組件  默認(rèn)false
setBuiltInZoomControls(boolean enabled) 
//--------------------------------------------------

//--------------------------------------------------
// 1 設(shè)置media 手勢(shì)播放media
setMediaPlaybackRequiresUserGesture(boolean require)
//--------------------------------------------------

//--------------------------------------------------
//寬度
// 1 設(shè)置概述模式瀏覽界面,當(dāng)頁(yè)面寬度超過(guò)WebView顯示寬度時(shí),縮小頁(yè)面適應(yīng)WebView。默認(rèn)false 
setLoadWithOverviewMode(boolean overview)    

// 2 設(shè)置支持ViewPort的meta tag屬性,如果頁(yè)面有ViewPort meta tag 指定的寬度,則使用meta tag指定的值,否則默認(rèn)使用寬屏的視圖窗口 
setUseWideViewPort(boolean use)  
//--------------------------------------------------

//--------------------------------------------------
// 字體和大小
// 1 設(shè)置頁(yè)面文字縮放百分比,默認(rèn)100% 
setTextZoom(int textZoom)  

// 2 設(shè)置最小字體,默認(rèn)8\. 取值區(qū)間[1-72],超過(guò)范圍,使用其上限值。 
setMinimumFontSize(int size)

//3 設(shè)置最小邏輯字體,默認(rèn)8\. 取值區(qū)間[1-72],超過(guò)范圍,使用其上限值。 
setMinimumLogicalFontSize(int size)  

//4 設(shè)置默認(rèn)字體大小,默認(rèn)16,取值區(qū)間[1-72],超過(guò)范圍,使用其上限值。 
setDefaultFontSize(int size)

//5 設(shè)置默認(rèn)填充字體大小,默認(rèn)16,取值區(qū)間[1-72],超過(guò)范圍,使用其上限值
setDefaultFixedFontSize(int size)  

//6 設(shè)置默認(rèn)字體大小 SMALLEST is 50% SMALLER is 75% NORMAL is 100% LARGER is 150% LARGEST is 200%
setTextSize(WebSettings.TextSize t)

//7 設(shè)置標(biāo)準(zhǔn)的字體族,默認(rèn)”sans-serif”。
setStandardFontFamily(String font) 

//8 設(shè)置混合字體族。默認(rèn)”monospace”
setFixedFontFamily(String font) 

//9 設(shè)置SansSerif字體族。默認(rèn)”sans-serif”
setSansSerifFontFamily(String font)

//10 設(shè)置SerifFont字體族,默認(rèn)”sans-serif” 
setSerifFontFamily(String font) 

//11 設(shè)置CursiveFont字體族,默認(rèn)”cursive” 
setCursiveFontFamily(String font)  

//12 設(shè)置FantasyFont字體族,默認(rèn)”fantasy” 
setFantasyFontFamily(String font)  

//13 設(shè)置頁(yè)面的編碼格式,默認(rèn)UTF-8
setDefaultTextEncodingName(String encoding)
//--------------------------------------------------------

//--------------------------------------------------------
//加載圖片
//1 設(shè)置是否加載圖片資源 包括嵌入的本地圖片資源和網(wǎng)絡(luò)圖片。 默認(rèn)true 
setLoadsImagesAutomatically(boolean flag)  

//2 是否加載網(wǎng)絡(luò)圖片資源 默認(rèn)true
setBlockNetworkImage(boolean flag) 

//3 設(shè)置是否加載網(wǎng)絡(luò)資源。注意如果值從true切換為false后,WebView不會(huì)自動(dòng)加載,除非調(diào)用WebView#reload()
setBlockNetworkLoads(boolean flag) 
//-------------------------------------------------------

//--------------------------------------------------------
//訪問(wèn)
//1 設(shè)置允許訪問(wèn)WebView內(nèi)部文件,默認(rèn)true 
setAllowFileAccess(boolean allow)  

//2 設(shè)置允許獲取WebView的內(nèi)容URL ,可以讓W(xué)ebView訪問(wèn)ContentPrivider存儲(chǔ)的內(nèi)容。 默認(rèn)true
setAllowContentAccess(boolean allow) 

//3 設(shè)置加載不安全資源的WebView加載行為,MIXED_CONTENT_ALWAYS_ALLOW和MIXED_CONTENT_NEVER_ALLOW 
setMixedContentMode(int mode)  
//--------------------------------------------------------

//緩存
//1 是否保存表單數(shù)據(jù),默認(rèn)false 
//setSaveFormData(boolean save) 

//2 是否允許數(shù)據(jù)庫(kù)存儲(chǔ)
setDatabaseEnabled(boolean flag)

//3 設(shè)置存儲(chǔ)定位數(shù)據(jù)庫(kù)的位置,考慮到位置權(quán)限和持久化Cache緩存
setGeolocationDatabasePath(String databasePath) 

//4 是否允許Cache,默認(rèn)false
setAppCacheEnabled(boolean flag)

//5 設(shè)置Cache API緩存路徑。
setAppCachePath(String appCachePath)

//6 是否存儲(chǔ)頁(yè)面DOM結(jié)構(gòu),默認(rèn)false
setDomStorageEnabled(boolean flag) 

//7 基于WebView導(dǎo)航的類型使用緩存 LOAD_DEFAULT 默認(rèn)加載方式 LOAD_CACHE_ELSE_NETWORK 按網(wǎng)絡(luò)情況使用緩存 LOAD_NO_CACHE 不使用緩存 LOAD_CACHE_ONLY 只使用緩存 
setCacheMode(int mode) 

//--------------------------------------------------------

//--------------------------------------------------------
//js
//1 設(shè)置是否允許執(zhí)行JS
setJavaScriptEnabled(boolean flag)  

//2 是否允許Js訪問(wèn)任何來(lái)源的內(nèi)容。包括訪問(wèn)file scheme的URLs
setAllowUniversalAccessFromFileURLs(boolean flag)

//3 是否允許Js訪問(wèn)其他file scheme的URLs
setAllowFileAccessFromFileURLs(boolean flag)  

//4 是否允許JS自動(dòng)打開(kāi)窗口。默認(rèn)false 
setJavaScriptCanOpenWindowsAutomatically(boolean flag)
//--------------------------------------------------------

// ------------------------------------------------------
// 其它
//1 設(shè)置WebView代理,默認(rèn)使用默認(rèn)值
setUserAgentString(String ua) 

//是否允許定位,默認(rèn)true
setGeolocationEnabled(boolean flag)

//是否支持多窗口,如果設(shè)置為true 
setSupportMultipleWindows(boolean support)

<a name="t6" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>JS和本地的互調(diào)

<a name="t7" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>JS調(diào)用Android

主要代碼:

mWebView = (WebView) findViewById(R.id.webview);  

WebSettings webSettings = mWebView.getSettings();  
webSettings.setJavaScriptEnabled(true);  
mWebView.addJavascriptInterface(mJavaInterface, "rrtoyewx");

其中

public void addJavascriptInterface(Object obj, String interfaceName)

第一個(gè)參數(shù)obj對(duì)象中實(shí)現(xiàn)JS調(diào)用android的實(shí)現(xiàn)的方法,第二個(gè)參數(shù)interfaceName是向WebView注入一個(gè)interfaceName的對(duì)象,這個(gè)對(duì)象綁定的是obj對(duì)象,即js的中調(diào)用方法的對(duì)象。

舉個(gè)例子

js調(diào)用android的sendMessage的方法,并傳遞一個(gè)String的參數(shù)。

js代碼

<html lang="en">  
    <head>  
        <meta charset="UTF-8">  
        <title>Title</title>  
        <h1>你好</h1>  
        <input type="button" value="js調(diào)native" onclick="ok()">  
    </head>  
    <body>  
        <script type="text/javascript">  
        function ok() {  
            rrtoyewx.sendMessage("我調(diào)用了android的中代碼");  
        }  
        </script>  
    </body>  
</html>  

android的代碼

mWebView = (WebView) findViewById(R.id.webview);  

WebSettings webSettings = mWebView.getSettings();  
webSettings.setJavaScriptEnabled(true);  
mWebView.addJavascriptInterface(mJavaInterface, "rrtoyewx");

JavaInterface的代碼

public class JavaInterface{
    @JavascriptInterface 
    public void sendMessage(String message){
        Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show(); 
    }
}

其中js調(diào)用java的代碼會(huì)造成Android WebView的Js對(duì)象注入漏洞,會(huì)造成一些安全性的問(wèn)題,關(guān)于這個(gè)的解決方法就是也有別人分析出并解決了

Android WebView的Js對(duì)象注入漏洞解決方案,其中對(duì)4.2以上采用@JavascriptInterface的注釋,而對(duì)于4.2以下的系統(tǒng)

1. 不使用addJavascriptInterface的方法。

2. 在WebChromeClient的方法中的回調(diào)方法中,去解析相應(yīng)的參數(shù),方法名,然后通過(guò)反射去相應(yīng)本地方法。

3. 如果存在返回值,則通過(guò)的load的方式,會(huì)調(diào)用的相應(yīng)的方法。

<a name="t8" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>Android 調(diào)用js的方法

loadUrl();

直接通過(guò)loadUrl()的方式去加載js的方法。

舉個(gè)例子

Android 調(diào)用js的alert的方法

Js

<html lang="en">  
    <head>  
        <meta charset="UTF-8">  
        <title>Title</title>  
        <h1 id="h">Rrtoyewx</h1>  
        <input type="button" value="js調(diào)native" onclick="ok()">  
    </head>  
    <body>  
        <script type="text/javascript">  
            function showAlert(i)  
            {  
                ....
            }  
        </script>  
    </body>  
</html> 

Android 的代碼

mWebView.loadUrl("javascript:showAlert(“java調(diào)用了js的方法”)");  

如果js的方法存在返回值,一種方式需要用js調(diào)用java的方式將返回值作為返回。而4.4之后,還有另一種方式,通過(guò)evaluateJavascript的方法去調(diào)用js的方法,并在valueCallBack的回調(diào)方法“onReceiveValue(String value)”的方法回調(diào)。

public void evaluateJavascript("methodName",valueCallBack)
mWebView.evaluateJavascript("getGreetings()", new ValueCallback() {  
       @Override  
       public void onReceiveValue(String value) {  
           Log.d("Rrtoyewx", value);  
       }  
   }); 

注意,回調(diào)方法在主線程,第二,返回值只接受string的


<a name="t9" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>WebViewClient的回調(diào)方法

<a name="t10" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onPageStarted

public void onPageStarted(WebView view, String url, Bitmap favicon)   

當(dāng)前頁(yè)面開(kāi)始加載時(shí)調(diào)用,我們可以在其中做一些準(zhǔn)備的工作,比如加載processbar

<a name="t11" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onPageFinished

public void onPageFinished(WebView view, String url)  

當(dāng)前頁(yè)面的加載完成時(shí)調(diào)用,我們可以在其中釋放一個(gè)資源,和關(guān)閉一些東西

<a name="t12" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>shouldOverrideUrlLoading

public boolean shouldOverrideUrlLoading(WebView view, String url)

函數(shù)會(huì)在加載其他的鏈接時(shí)回調(diào),表示webview是否屏蔽的這個(gè)鏈接,默認(rèn)返回false,如果返回true則表示不會(huì)加載這個(gè)url了。我們可以在其中屏蔽一些操作。

<a name="t13" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onReceivedError

public void onReceivedError(WebView view, int errorCode,String description, String failingUrl)  

參數(shù)的說(shuō)明:WebView view:當(dāng)前的WebView實(shí)例,int errorCode:錯(cuò)誤碼,String description:錯(cuò)誤描述,String failingUrl:當(dāng)前出錯(cuò)的URL。一般加載本地的404界面的,即出現(xiàn)一個(gè)錯(cuò)誤提示。

<a name="t14" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onReceivedSslError

public void onReceivedSslError(WebView view, SslErrorHandler handler,SslError error) 

HTTPS協(xié)議是通過(guò)SSL來(lái)通信的,所以當(dāng)使用HTTPS通信的網(wǎng)址(以https://開(kāi)頭的網(wǎng)站)出現(xiàn)錯(cuò)誤時(shí),就會(huì)回調(diào)的該方法,參數(shù)說(shuō)明

WebView view:當(dāng)前的WebView實(shí)例,SslErrorHandler handler:SslErrorHandler.proceed()和SslErrorHandler.cancel(),SslErrorHandler.proceed()表示忽略錯(cuò)誤繼續(xù)加載,SslErrorHandler.cancel()表示取消加載。在onReceivedSslError的默認(rèn)實(shí)現(xiàn)中是使用的SslErrorHandler.cancel()來(lái)取消加載。SslError error:當(dāng)前的的錯(cuò)誤對(duì)象,SslError包含了當(dāng)前SSL錯(cuò)誤的基本所有信息。

注意

1 onReceivedSslError回調(diào),不一定會(huì)回調(diào)onReceivedError的方法。

2 加載默認(rèn)的onReceivedSslError的會(huì)出現(xiàn)的白屏。

3 可以忽略這個(gè)錯(cuò)誤繼續(xù)加載的

<a name="t15" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>shouldInterceptRequest

public WebResourceResponse shouldInterceptRequest(WebView view,  
        String url) ;

當(dāng)頁(yè)面中許多的資源文件,每請(qǐng)求一個(gè)資源文件,都會(huì)回調(diào)這個(gè)方法,這個(gè)不主線程調(diào)用。所以我們可以在請(qǐng)求資源的時(shí)候,在這里屏蔽一些操作

<a name="t16" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onLoadResource

public void onLoadResource(WebView view, String url

請(qǐng)求資源文件的時(shí)候調(diào)用,

<a name="t17" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onScaleChanged

public void onScaleChanged(WebView view, float oldScale, float newScale)  

webView的發(fā)生縮放改變的時(shí)候調(diào)用

<a name="t18" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>shouldOverrideKeyEvent

public boolean shouldOverrideKeyEvent(WebView view, KeyEvent event)  

屏蔽一個(gè)按鍵的操作,返回false,則不屏蔽,交給webview處理,true反之

<a name="t19" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onFormResubmission

onFormResubmission(WebView view, Message dontResend, Message resend)  

設(shè)置是否重發(fā)數(shù)據(jù),post的請(qǐng)求的時(shí)候,默認(rèn)不重新發(fā)送

<a name="t20" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>doUpdateVisitedHistory

doUpdateVisitedHistory(WebView view, String url, boolean isReload) 

通知主機(jī)程序更新訪問(wèn)的鏈接

<a name="t21" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onUnhandledInputEvent

onUnhandledInputEvent(WebView view, InputEvent event) 

讓主程序處理WebView未處理的Input Event。

<a name="t22" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onReceivedLoginRequest

onReceivedLoginRequest(WebView view, String realm, String account, String args)

自動(dòng)登錄請(qǐng)求的回調(diào)方法


<a name="t23" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>WebChromeClient的事件

<a name="t24" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onJsAlert

public boolean onJsAlert(WebView view, String url, String message,JsResult result)

網(wǎng)頁(yè)調(diào)用alert的時(shí)候調(diào)用

<a name="t25" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onJsConfirm(),返回值代表是否消費(fèi), JsResult 的cancle的方法和con

public boolean onJsConfirm(WebView view, String url, String message,JsResult result)

網(wǎng)頁(yè)調(diào)用confirm的時(shí)候調(diào)用,返回值代表是否消費(fèi),

<a name="t26" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onJsPrompt

public boolean onJsPrompt(WebView view, String url, String message,String defaultValue, JsPromptResult result) 

網(wǎng)頁(yè)調(diào)用prompt的時(shí)候調(diào)用,返回值代表是否消費(fèi),

<a name="t27" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onConsoleMessage

public boolean onConsoleMessage(ConsoleMessage consoleMessage)

打印console的消息的時(shí)候,常用來(lái)監(jiān)視js代碼的錯(cuò)誤

<a name="t28" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onProgressChanged

 public void onProgressChanged(WebView view, int newProgress)

加載頁(yè)面的進(jìn)度的改變的時(shí)候,

<a name="t29" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onReceivedTitle

public void onReceivedTitle(WebView view, String title)

頁(yè)面的title的發(fā)生變化時(shí)候的回調(diào)

<a name="t30" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onReceivedIcon

public void onReceivedIcon(WebView view, Bitmap icon)

接受到新的icon的回調(diào)方法

<a name="t31" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onReceivedTouchIconUrl

public void  onReceivedTouchIconUrl(WebView view, String url, boolean precomposed)

頁(yè)面的按下圖標(biāo)的icon的url

<a name="t32" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>getVisitedHistory

public void getVisitedHistory(ValueCallback callback)

獲取訪問(wèn)頁(yè)面的訪問(wèn)歷史

<a name="t33" style="box-sizing: border-box; background: transparent; color: rgb(79, 161, 219); text-decoration: none; margin: 0px; padding: 0px; font-weight: 400; outline: 0px;"></a>onShowFileChooser

public boolean onShowFileChooser(WebView webView, ValueCallback filePathCallback,FileChooserParams fileChooserParams)

試圖打開(kāi)文件的瀏覽器的回調(diào)方法,其中fileChooserParams對(duì)象包含的許多的信息。比如打開(kāi)文件的mimeType,mode等


from:http://blog.csdn.net/zhi184816/article/details/51832711

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容