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

  • SEARCH
  • Home
  • 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 9145421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:30:37+00:00 2026-06-17T10:30:37+00:00

I have an Android webview with a page that redirects to another page, using

  • 0

I have an Android webview with a page that redirects to another page, using location.replace(url).
Lets say that I have page “A” that redirects to page “B” (using location.replace). When pressing “back” button from page “B”, the page returns to page “A”, which redirects it to page “B” again.
When I debug the history api (history.length), I can clearly see that on page “B” the length has incremented in “1” (only on Android 4.X webview. On iOS / web browser / Android 2.X it remains the same), which is a bug! (location.replace shouldn’t change history.lenght!)

  • 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-06-17T10:30:38+00:00Added an answer on June 17, 2026 at 10:30 am

    I work with Yaniv on this project and we found the cause of the problem, it was introduced when we tried to add mailto: links handling according to this answer.

    The answer suggested using the following extending class of WebViewClient:

    public class MyWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {     
            if(MailTo.isMailTo(url)){
                MailTo mt = MailTo.parse(url);
                // build intent and start new activity
                return true;
            }
            else {
                view.loadUrl(url);
                return true;
            }
        }
    }
    

    The problem was that explicitly telling the WebViewClient to load the URL and returning true (meaning “we handled this”) added the page to the history. WebViews are quite capable of handling regular URLs by themselves, so returning false and not touching the view instance will let the WebView load the page and handle it as it should.

    So:

    public class MyWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {     
            if(MailTo.isMailTo(url)){
                MailTo mt = MailTo.parse(url);
                // build intent and start new activity
                return true;
            }
            else {
                return false;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an android app that register a custom url scheme (let's say app://)
I am using the WebView of Android so that I will not have to
I have Android client app that communicates with server using Socket . On my
I have an Android application that is a TabHost with a WebView. I use
I'm using Android, and I've created a Webview which nicely opens my HTML page
So I have this Android Application that's in WebView that should pass the data
I have a Android 2.1 application with a WebView. In that WebView I want
I've an android-app (Android SDK 10) with a WebView. On that WebView I have
I have created an android app that is using a custom-rolled authentication method by
I have created an application for the Android that displays HTML pages through WebView

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.