Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ Android webView URL redirects affect goBack ()     - Machine Learning: Classification of the curse of dimensionality (Programming)

- Linux Security (Linux)

- Use OpenSSL to generate a certificate detailed process (Linux)

- Kubernetes (k8s) environment to build combat (Server)

- File easier to compare tools under Linux (Linux)

- Postgres-X2 deployment steps (Database)

- To install OwnCloud 7.0.4 under Ubuntu (Linux)

- Oracle database import and export (Database)

- How to install Eclipse Luna IDE on CentOS 7 / RHEL 7 (Linux)

- C # how to generate a folder or file automatically rename (Programming)

- Observation network performance tools for Linux (Linux)

- The OpenGL ES GLFW window structures (Programming)

- Security matters and practical Linux System (Linux)

- Getting Started with Linux: Learn how to upgrade Docker in Ubuntu (Server)

- How MySQL tracking sql statement (Database)

- Ubuntu 14.04 Trusty Tahr User How to install Banshee 2.9.1 (Linux)

- RedHat virtual machine to install VMware Tools (Linux)

- KUbuntu / Ubuntu 14.04 (downgrade) installed SVN 1.7 (Linux)

- Linux file system structure Introduction (Linux)

- ELKstack log analysis platform (Server)

  Android webView URL redirects affect goBack ()
  Add Date : 2018-11-21      
  Control webView when Android comes with access to a URL, the URL will redirect some way, then there will be a problem.

As follows:

You want to open "C URL" in the "A URL", but it is actually open "C URL" when it is required by "B URL" to transit.

It appeared in the following situation:

A URL -> B site (redirects to C) -> C Website
Well, look at it now and then some of our habits when using webView.

If we say we do not want to allow users webView click connection, allowing users to open the system browser to navigate, but continue to use our webView browse words.

Our general practice:

webView.setWebViewClient (new WebViewClient () {
public boolean shouldOverrideUrlLoading (WebView view, String url) {
            // Control new connections open in the current WebView
            webView.loadUrl (url);
            return true;
Through the above method, so that our browser can continue to access the links page, but the above manner, it met the needs required retreat, there is a problem.

We assume that this time, users need to "C URL" to return to the "A site" users themselves do not know the middle of a "B URL", the presence of users just want to click on my goBack time, we will return to the "A URL "

But look at the above structural formula is: A URL -> B site (redirects to C) -> C web site.

This can be judged directly call webView.goBack () will return to the "B URL", but "B URL" URL function is redirected to the "C URL", so users see a phenomenon that can not be goBack , the CPC goBack, and again return to the "C web site."

The above problem how to solve it?

Modify, override the method above us.

webView.setWebViewClient (new WebViewClient () {
        public boolean shouldOverrideUrlLoading (WebView view, String url) {
            return false; // doc comment on is: True if the host application wants to handle the key event itself, otherwise return false (if the program needs to deal with, it returns true, if not addressed, it returns false)
            // This place we return false, does not deal with it, give it to webView own process.
- Linux User Rights Study Notes (Linux)
- Oracle: RETURNING clause (Database)
- CentOS 7.0 local address and configure yum source address priority (Linux)
- ORA-28000 the account is locked fault simulation (Database)
- VMware Workstation + Ubuntu 10.04 Download the Android 2.2 source code (Linux)
- Tomcat installation under Linux (Server)
- CV: Linux command displays the progress of the run command (Linux)
- According to the national position on how to block traffic in Linux (Server)
- Use top to monitor the remote server (Server)
- KUbuntu / Ubuntu 14.04 (downgrade) installed SVN 1.7 (Linux)
- How to manage KVM virtual environments with command-line tools in Linux (Server)
- Graphing tool: Gnuplot (Linux)
- How to use the on-screen keyboard in Linux (Linux)
- Linux environment variable configuration and save places (Linux)
- Ubuntu how to install and use Objective-C (Linux)
- Specifies the open ports of the SUSE firewall settings (Linux)
- Linux server operating system security configuration (Linux)
- Package the Python script file into an executable file (Programming)
- Clojure programming languages: take full advantage of the Clojure plug-in Eclipse (Programming)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.