Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Android webView URL redirects affect goBack ()     - Mac OS X systems create Ubuntu USB boot disk for the Mac (Linux)

- Java is simple to read and write HDFS Demo (Programming)

- Binary tree and some basic operations with binary list (Programming)

- Shell commonly commands (Linux)

- XenServer Virtual Machine Installation --- first ISO image file storage expansion (Linux)

- After Oracle 11g dataguard failover rebuild the archive logs are not applied to be NO problem (Database)

- How to write a new Git protocol (Linux)

- Relationship between Linux permissions with the command (Linux)

- Commonly used Linux system camouflage method (Linux)

- Deployment Kubernetes manage Docker example cluster on Ubuntu (Server)

- Linux shell script under the use of randomly generated passwords (Programming)

- iOS9 new feature - stacked view UIStackView (Programming)

- Oracle PL / SQL selective basis (IF CASE), (LOOP WHILE FOR) (Database)

- Android Delete project useless resource file (Programming)

- Understanding Java classes (Programming)

- Docker deployment practices in Ubuntu (Server)

- SYN attack hacker attack and defense of the basic principles and prevention technology (Linux)

- Nodejs mysql pool Example (Programming)

- How do you access Dropbox Linux command line (Linux)

- Recover accidentally deleted Nginx logs (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:

1
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 () {
        @Override
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 () {
        @Override
        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.
        }
});
     
         
         
         
  More:      
 
- Build the first ASP.NET 5 Web project in Mac OS X Yosemite 10.10.3 (Server)
- Linux command line under HTTP traffic sniffing tool: httpry (Linux)
- C ++ virtual functions Classic Insights (Programming)
- Firewall settings oracle remote connection in Linux systems (Linux)
- Effect MongoDB plan cache (Database)
- The Java development environment to build under Ubuntu 14.04 (Linux)
- EXP-00091: Exporting questionable statistics Processing Method (Database)
- How to configure Ceph stored on CentOS 7.0 (Server)
- CentOS7 Kubernetes used on container management (Server)
- C language to view various types of data size (Programming)
- Port is not being used, how will bind failure? (Server)
- Docker Basic Concepts (Linux)
- Denyhosts prevent hackers using SSH scanning (Linux)
- Linux iptables firewall settings (Linux)
- How to install the latest version of the Eclipse in Ubuntu 14.04 (Linux)
- MySQL high availability cluster fragmentation of deployment uses Fabric (Database)
- CKEditor + SWFUpload achieve a more powerful editor (Linux)
- 12 kinds of detection of CPU information on a Linux system tools (Linux)
- Linux C source code (Ascii HexToBinary: Converts hexadecimal string format ASCII codes) (Programming)
- How to use the Docker Machine cluster deployment Swarm (Server)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.