Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WebView myWebView = (WebView) getActivity().findViewById(R.id.webview);
- myWebView.setWebViewClient(new WebViewClient() {
- public boolean shouldOverrideUrlLoading(WebView view, String url) {
- view.loadUrl(url);
- // this fires when the IUAM navigated to the captcha JSON
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
- view.evaluateJavascript(
- "(function() { return ('<html>'+document.getElementsByTagName('html')[0].innerHTML+'</html>'); })();",
- new ValueCallback < String > () {
- @Override
- public void onReceiveValue(String html) {
- // here is the logic for captcha getting
- System.out.println(html);
- }
- });
- }
- return false;
- }
- });
- // should be non-browser otherwise it will never complete. use for example fourchan/1.0
- myWebView.getSettings().setUserAgentString(UserAgentProvider.getInstance().getUserAgent());
- myWebView.setHorizontalScrollBarEnabled(true);
- myWebView.setVerticalScrollBarEnabled(true);
- WebSettings webSettings = myWebView.getSettings();
- webSettings.setJavaScriptEnabled(true);
- // notice that user should make a gesture.
- myWebView.loadUrl("https://sys.4chan.org/captcha?board=b");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement