Intercept POST requests in a WebView

I was facing the same issue a few days ago. So I built a library that solves it: https://github.com/KonstantinSchubert/request_data_webviewclient It is a WebViewClient with a custom WebResourceRequest that contains the POST/PUT/… payload of XMLHttpRequest requests. It only works for these though – not for forms and other kind of request sources. The hack works, basically, … Read more

In Android Webview, am I able to modify a webpage’s DOM?

To expand on CommonsWare’s correct answer: WebView webview = new WebView(); webview.setWebViewClient(new WebClient()); webView.getSettings().setJavaScriptEnabled(true); webview.loadUrl(“stackoverflow.com”); then in WebClient: public class WebClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } @Override public void onPageFinished(WebView view, String url) { // Obvious next step is: document.forms[0].submit() view.loadUrl(“javascript:document.forms[0].q.value=”[android]””); } } In a … Read more

Android webview loading data performance very slow

I think the following works best: if (Build.VERSION.SDK_INT >= 19) { webView.setLayerType(View.LAYER_TYPE_HARDWARE, null); } else { webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); } Android 19 has Chromium engine for WebView. I guess it works better with hardware acceleration. For more info Android 4.4 KitKat, the browser and the Chrome WebView Hardware Acceleration also do’s the trick.You can use it … Read more

Android WebView Hardware Acceleration Artefact Workarounds

add: -webkit-backface-visibility: hidden; -webkit-perspective: 1000; backface-visibility: hidden; perspective: 1000; if you working with 3d transform.. it is a cheap trick BUT it will improve the performance espacially on iPad.. furthermore you can try to -webkit-transform: rotateZ(0deg); AFAIK rotations can boost the performance because gpu´s are much better in rotating something.. another way is to lay … Read more

WebView textarea doesn’t pop up the keyboard

The full solution is a bit more than what Sana had. It is documented as a bug over at the Android site ( http://code.google.com/p/android/issues/detail?id=7189 ): webView.requestFocus(View.FOCUS_DOWN); webView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_UP: if (!v.hasFocus()) { v.requestFocus(); } break; } return false; } });

Fixed header disappear when scrolling down in webview in iOS 11

I’m just writing some code, try with one by one Try with below self.automaticallyAdjustsScrollViewInsets = false Try with below [self.webView.scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever]; Try with below (change your code) header { height: 60px; background-color: @mainColor; color: #ffffff; padding: 10px; text-align: center; position: fixed; width: 100%; z-index: 1; transform: translateZ(0); -moz-transform: translatez(0); -ms-transform: translatez(0); -o-transform: translatez(0); -webkit-transform: translateZ(0); … Read more

onShowFileChooser() from android webview works only once

firstly, sorry to my english. you should return empty Uri[]{} to file receive mUploadMessageForAndroid5.onReceiveValue(new Uri[]{}); my code can choose take photo or local image: private static final int REQUEST_GET_THE_THUMBNAIL = 4000; private static final long ANIMATION_DURATION = 200; public final static int FILECHOOSER_RESULTCODE = 1; public final static int FILECHOOSER_RESULTCODE_FOR_ANDROID_5 = 2; //JS webView.getSettings().setJavaScriptEnabled(true); //set … Read more

Is there a listener for when the WebView displays it’s content?

I successfully used Richard’s answer with a PictureListener for a few years, but I no longer recommend this as the best solution. This is for two reasons: webView.setPictureListener and PictureListener are both deprecated. Using this listener will cause the WebView to allocate a new Picture often. This allocation is expensive and this can have some … Read more