Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4015574
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:38:08+00:00 2026-05-20T09:38:08+00:00

When I call WebView#loadUrl I expect that I should only get a single WebViewClient#onPageFinished

  • 0

When I call WebView#loadUrl I expect that I should only get a single WebViewClient#onPageFinished call and no WebViewClient#shouldOverrideUrlLoading call. However, I get a WebViewClient#shouldOverrideUrlLoading (which I implement by always calling WebView#loadUrl and returning true) and then two WebViewClient#onPageFinished calls with the same URL.

The page I’m loading uses a lot of ajax requests. Do ajax requests invoke the WebViewClient? My page does not have any meta-refreshes in it.

This is quite frustrating. Am I doing something wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:38:09+00:00Added an answer on May 20, 2026 at 9:38 am

    This is a cross-post from a google groups discussion I started on the topic.

    I’ve done more research, and I think I understand everything that’s going on.

    Here is my WebViewClient:

    public class MyWebViewClient extends WebViewClient {
      @Override
      public void onPageStarted(WebView view, String url, Bitmap favicon) {
        System.out.println("onPageStarted: " + url);
      }
    
      @Override
      public boolean shouldOverrideUrlLoading(WebView webView, String url) {
        System.out.println("shouldOverrideUrlLoading: " + url);
        webView.loadUrl(url);
        return true;
      }
    
      @Override
      public void onPageFinished(WebView webView, String url) {
        System.out.println("onPageFinished: " + url);
      }
    }
    

    I have the following URL redirects from my server:

    http://example.com/resource -> http://example.com/user-name/resource
    http://example.com/logout.jsp -> http://example.com/login/logout
    http://example.com/login/logout -> http://example.com/login
    

    These URLs are part of a server that I don’t control, so I just have to deal with the behavior.

    Here is the output from loading http://example.com/resource

    onPageStarted: http://example.com/resource
    onPageStarted: http://example.com/user-name/resource
    shouldOverrideUrlLoading: http://example.com/user-name/resource
    onPageFinished: hhttp://example.com/user-name/resource
    

    at this point, my WebView has blank content. I must wait until after the second onPageFinished to grab my content.

    onPageStarted: http://example.coms/user-name/resource
    onPageFinished: http://example.com/user-name/resource
    

    Here is the output from loading http://example.com/logout.jsp

    onPageStarted: http://example.com/logout.jsp
    onPageStarted: http://example.com/login/logout
    shouldOverrideUrlLoading: http://example.com/login/logout
    onPageFinished: http://example.com/login/logout
    onPageStarted: http://example.com/login/logout
    onPageStarted: http://example.com/login
    shouldOverrideUrlLoading: http://example.com/login
    onPageFinished: http://example.com/login
    

    again, at this point, my WebView has a blank page. I have to wait until the 3rd onPageFinished to get my content from the WebView.

    onPageStarted: http://example.com/login
    onPageFinished: http://example.com/login
    

    Based on the documentation, I don’t expect this behavior. Notice that there is an unbalanced number of onPageStarteds and onPageFinisheds. I especially dislike how onPageFinished gets called with my redirected URL, yet the WebView doesn’t contain my content. I understand that this behavior is probably unchangeable, but this unexpected behavior should at least be documented.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Every call to the server gets the Accept-Language value, but can I get that
In a class belonging to a Library project I call: webview.loadUrl(file:///android_asset/info.html, null); Unfortunately, this
I'm working with a WebView. If I place this call in my -awakeFromNib :
I call my JavaScript function. Why do I sometimes get the error 'myFunction is
I need to call into a Win32 API to get a series of strings,
I have an application on appspot that works fine through regular browser, however when
I am giving the following method call to my webview client embedded in my
In the [webView:shouldStartLoadWithRequest:navigationType:] event, how can you tell the difference between an iframe that's
I have a WebView that I need to ask to load a website from
I am writing an android application that has a webview. On the first load

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.