L
L
Lamaster2013-10-16 13:34:55
Android
Lamaster, 2013-10-16 13:34:55

Redirect link with anchor in WebViewClient?

Has anyone experienced a redirect issue on an inner webView initialized with a WebViewClient?
The trouble is that it does not catch a link of the form http://www.ru/index.html#label2. That is, it does not catch the anchor, at all.
Here is a piece of code:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    webview = (WebView) findViewById(R.id.webView1);
    webview.setWebViewClient(new WebViewClient() {
      @Override
      public boolean shouldOverrideUrlLoading(WebView view, String url) {
        Log.i("", "shouldOverrideUrlLoading url=" + url);
        // TODO Auto-generated method stub
        return super.shouldOverrideUrlLoading(view, url);
      }

      @Override
      public void onPageFinished(WebView view, String url) {
        Log.i("", "onPageFinished url=" + url);
        // TODO Auto-generated method stub
        super.onPageFinished(view, url);
      }
    });
    webview.getSettings().setLoadWithOverviewMode(false);
    webview.getSettings().setUseWideViewPort(false);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
    webview.getSettings().setUserAgentString("android.RTkabinet");
    String url = "https://paycard.rt.ru/payallrbs_rtk.jsp?sourceSystem=1002&payMethod=YandexMoney&item=98000607231;1;RT.SOUTH.23.CONTRACT_ID";
    webview.loadUrl(url);
  }

Stackoverflow has examples of working with local files file:///file.html, but this is done through crutches and they load directly through loadUrl. I need to accept the redirect. In fact, shouldOverrideUrlLoading() does not even indicate that an anchor link has arrived and I will never know about it.
Artificially coincidentally known end link, tried to load on link with anchor http://link#0, but it didn't work.
How can you beat android?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question