webchromeclient

WebView + WebChromeClient method onCreateWindow not called for target=“_blank”

主宰稳场 提交于 2019-11-28 06:03:45
I'm trying to develop a custom browser with WebView using Android API level 10 (sdk 2.3.3), unfortunately I don't know how to intercept request from the webpage to open URL in new browser window, like taps on links with target="_blank" . In conformity with the API Doc I have overridden the onCreateWindow of WebChromeClient , but is not called when such a link is tapped. Could be a bug of this API level? I'm also overriding shouldOverrideUrlLoading to avoid WebView opening subsequent links in the built-in browser. Here is my sample code that opens google.com . To test it, tap "News" and then

Are WebViewClient and WebChromeClient mutually exclusive?

本秂侑毒 提交于 2019-11-28 03:14:55
From this great explanation about the differences between WebViewClient and WebChromeClient it seems that if you use one, you shouldn't be using the other (for the same WebView object). Is my understanding correct? If not, when would one use both WebViewClient and WebChromeClient for the same WebView object? Is there an example of a situation where only use both WebViewClient and WebChromeClient for the same WebView object would accomplish a certain goal? You certainly can use both, they just have different functions. Setting your own custom WebViewClient lets you handle onPageFinished,

Android WebView Playing HTML5/h.264/mp4 Video, How to get at the MediaPlayer

↘锁芯ラ 提交于 2019-11-27 23:29:35
问题 I have an Activity which is a WebView . I have a WebChromeClient inside it. Inside that, there are several callbacks which are meant to return the MediaPlayer handling the video bits. For example: @Override public void onPrepared(MediaPlayer mp) { Log.i(TAG, " -------------> onPrepared"); } These fail to fire when I load an MP4 stream into the WebView using HTML <video> tags (via injection). When I finish() the activity, the logcat reports this: 09-13 23:55:24.590: E/MediaPlayer(7949):

WebView + WebChromeClient method onCreateWindow not called for target=“_blank”

情到浓时终转凉″ 提交于 2019-11-27 01:11:05
问题 I'm trying to develop a custom browser with WebView using Android API level 10 (sdk 2.3.3), unfortunately I don't know how to intercept request from the webpage to open URL in new browser window, like taps on links with target="_blank" . In conformity with the API Doc I have overridden the onCreateWindow of WebChromeClient , but is not called when such a link is tapped. Could be a bug of this API level? I'm also overriding shouldOverrideUrlLoading to avoid WebView opening subsequent links in

What's the difference between setWebViewClient vs. setWebChromeClient?

半腔热情 提交于 2019-11-26 23:26:24
What's the difference between setWebViewClient vs. setWebChromeClient in Android? Cristian From the source code : // Instance of WebViewClient that is the client callback. private volatile WebViewClient mWebViewClient; // Instance of WebChromeClient for handling all chrome functions. private volatile WebChromeClient mWebChromeClient; // SOME OTHER SUTFFF....... /** * Set the WebViewClient. * @param client An implementation of WebViewClient. */ public void setWebViewClient(WebViewClient client) { mWebViewClient = client; } /** * Set the WebChromeClient. * @param client An implementation of

What&#39;s the difference between setWebViewClient vs. setWebChromeClient?

只愿长相守 提交于 2019-11-26 07:52:11
问题 What\'s the difference between setWebViewClient vs. setWebChromeClient in Android? 回答1: From the source code: // Instance of WebViewClient that is the client callback. private volatile WebViewClient mWebViewClient; // Instance of WebChromeClient for handling all chrome functions. private volatile WebChromeClient mWebChromeClient; // SOME OTHER SUTFFF....... /** * Set the WebViewClient. * @param client An implementation of WebViewClient. */ public void setWebViewClient(WebViewClient client) {