Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ Android webView URL redirects affect goBack ()     - Ubuntu Live CD by updating Grub resume boot the Boot Menu (Linux)

- VMware virtual machine to use bridged mode fast Internet access (Linux)

- To install and deploy Apache under the CentOS (Server)

- Daemon under Linux (Linux)

- 20 Unix / Linux command skills (Linux)

- Use dump restore mode fast backup and recovery system FreeBSD (Linux)

- Linux how to handle file names that contain spaces and special characters (Linux)

- Flow control message transmission between RAC (Database)

- lack of SWAP space during installation of Oracle (Database)

- Java-based data source database access (Programming)

- Linux (Ubuntu) How iptables port mapping (Server)

- Linux Telnet access Windows 7 configuration procedure (Linux)

- To install Cinnamon desktop environment on your Ubuntu 14.04 / 12.04 (Linux)

- How to Install terminator 0.98 on Ubuntu and Linux Mint (Linux)

- Create the best introductory tutorial REST API (Linux)

- Fedora 8 configured Heartbeat (Linux)

- 7 extremely dangerous Linux commands (Linux)

- Mass data storage application of MongoDB database (Database)

- Linux system package manager (rpm, yum, source packages installation) (Linux)

- Linux top command to get started (Linux)

  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.
- Install and configure GO 1.2.1 under CentOS 6.5 (Linux)
- Terminal Linux command prints - echo (Linux)
- A process of how to get the current traffic in GNU Linux (Linux)
- Oracle 11g maintenance partitions (Seven) - Modifying Real Attributes of Partitions (Database)
- Oracle archive log summary (Database)
- How to test your MongoDB application upgrade? (Database)
- Ubuntu 14.10 Apache installation and configuration (Server)
- Oracle lag () and lpad () function (Database)
- vector C ++ sequence containers (Programming)
- Linux kernel RCU (Read Copy Update) lock Brief (Linux)
- Fedora 8 configured Heartbeat (Linux)
- Ubuntu 14.10 / 14.04 how to install Quick Start tool Mutate 2.2 (Linux)
- Linux bash: scp: command not found the problem (Linux)
- Spring Boot + Nginx + Tomcat + SSL configuration notes (Server)
- Linux asynchronous read documents by AIO (Programming)
- Java concurrent programming using the synchronized keyword ReentrantLock alternative primitive (Programming)
- quotacheck command file can not be created aquota.user and aquota.group solutions (Linux)
- How to deploy Icinga server (Server)
- MongoDB Installation under CentOS 6.6 (Database)
- RedHat command line and graphical interface switching (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.