Menu
  • HOME
  • TAGS

Android Ask for permission to use location within webview

java,android,webview,webviewclient,webchromeclient

That's because you need to create the prompt. The onGeolocationPermissionsShowPrompt function is simply called to let you know the webpage wants the location. callback.invoke(origin, true, false); is the response telling the WebView it's OK to use the location. The last argument is whether or not to remember this setting. See:...

Accessing Activity Methods from WebChromeClient

javascript,android,xamarin,webchromeclient

Accept and store a reference of type MainActivity in myWebChromeClient class. Only then can you call the setUpGraph() function in MainActivity. EDIT The myWebChromeClient class: class myWebChromeClient : WebChromeClient { public MainActivity activity; public override void OnProgressChanged(WebView view, int newProgress) { base.OnProgressChanged(view, newProgress); if (newProgress == 100) { activity.setUpGraph(); }...

Get loaded resource files list from android webview

android,android-webview,webchromeclient

You can get the list of resources the WebView is trying to load by overriding WebViewClient.shouldInterceptRequest like so: class MyWebViewClient extends WebViewClient { @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { android.util.Log.i("MyWebViewClient", "attempting to load resource: " + url); return null; } @Override public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {...

WebChromeClient OnJSAlert is not called

javascript,android,webview,webchromeclient

If you use a method name without the proper spelling, your method calls will not work onJSAlert Change to: onJsAlert ...

Workaround for file uploads on Android 4.4 using reflection

android,android-webview,webchromeclient

If you're looking for a clean solution to do this this without using tricky Javascript codes and detectors. I'd recommend using a Webview alternative. Crosswalk I'd recommend this. It'll work similar to the official webview. It's open source and made by the same people behind ChromeView. They've got a great...

Do something if WebView url contains a string

android,webview,android-studio,webviewclient,webchromeclient

You have, webView.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { String url = webView.getUrl(); if (url.contains("string")) { code = url.substring(url.lastIndexOf("value=") + 6); dialog.dismiss(); //action } return false; } } Ref : http://developer.android.com/reference/android/webkit/WebViewClient.html#shouldOverrideUrlLoading(android.webkit.WebView,java.lang.String)...

console message captured by onConsoleMessage is incomplete

java,android,webview,webchromeclient

An interesting bug! You can wrap console.log in your own function that concatenates all the arguments into a single string. The JavaScript code for doing this is below: (function() { var oldLog = console.log; console.log = function() { oldLog.call(console, Array.prototype.slice.call(arguments).join(" ")); } })(); You can inject it into your page...

Webview HTML Video fullscreen - onShowCustomView() called only once

android,html5,android-webview,html5-video,webchromeclient

In order for this to work correctly, I learned that I needed to get the video view Holder and put it in another view. However, I wanted to use my own custom fullscreen view. In order to do that I made my own custom HTML video controls for using CSS...

Triggering WebChromeClient onRequestFocus

java,android,android-webview,webchromeclient

I found the answer. Create webpage with two frames <html> <frameset rows=20%,80%> <frame src="frame1.html" name="myFrame1" /> <frame src="frame2.html" name="myFrame2" /> </frameset> </html> and place a link in frame1.html with target set to myFrame2 <a id="link" href="frame3.html" target="myFrame2">Click me!</a> ...