Posts

Showing posts with the label webview

Android WebView shouldInterceptRequest?

Android WebView shouldInterceptRequest? I need to intercept android requests. I passed an HTTPClient and implemented shouldInterceptRequest. The doc says If the return value is null, the WebView will continue to load the resource as usud But when I return the value of super or return null it breaks and won't load the webview? Any thoughts? class WebViewClientImpl(val webView: WebView): WebViewClient() { @RequiresApi(Build.VERSION_CODES.LOLLIPOP) override fun shouldInterceptRequest(view: WebView?, request: WebResourceRequest?): WebResourceResponse? { retuen null } } By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Go back to previous screen on SslErrorHandler

Go back to previous screen on SslErrorHandler So in my webview, I am showing an error dialog box for SSL security issues which Google had made compulsory. The code looks like below: @Override public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) { final AlertDialog.Builder builder = new AlertDialog.Builder(LaunchWVActivity.this); builder.setMessage("SSL cert is invalid.Install a valid certificate or click continue to proceed."); builder.setPositiveButton("continue", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { handler.proceed(); } }); builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() ...

Webview closes automatically after taking picture from camera

Webview closes automatically after taking picture from camera I use webview in my android app. In this i use camera to take picture. After taking picture and tap on right sign webview closes automatically, and throws me to the app dashboard. It not happens every time but throws 2 or 3 times in 10 attempt. I also use mWebview.requestFocus(); but it not help Post your code. – Sagar Zala Jun 29 at 10:26 By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

WKWebview problems with opening ads or links

WKWebview problems with opening ads or links I created a iOS webapp with WKWebview (Swift) for our website. Everything is going fine, but I have a lot of problems with clicking on ads and links. I handled it like this: func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { if navigationAction.navigationType == .linkActivated { let url = navigationAction.request.url if let url = navigationAction.request.url, let host = url.host, !host.hasPrefix("www.example"), UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url) print(url) print("Redirected to browser. No need to open it locally") decisionHandler(.cancel) } else if url?.description.lowercased().range(of: "tel:") != nil || url?.description.lowercased().range(of...