Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Android webView URL redirects affect goBack ()     - How to use Linux to download music from Grooveshark (Linux)

- Growth since Oracle set the table space (Database)

- Two alert log ORA Errors (Database)

- Docker + OpenvSwitch build experimental environment VxLAN (Server)

- Learn to read the source code of vmstat (Linux)

- How Linux Log Analysis (Linux)

- Linux common commands MEMO (Linux)

- Visual Studio Code experience (Linux)

- Teach you how to protect the security of Linux desktop (Linux)

- Linux System Administrator Network Security Experience (Linux)

- Linux shell script to adjust the Task Scheduler (Linux)

- Java heap (Heap) and stack difference (Programming)

- MyCAT log analysis (Database)

- CentOS 7 Change Hostname (Linux)

- CentOS 5.10 installed Oracle 11G R2 (Database)

- Customize own small private Linux system (Linux)

- Use top to monitor the remote server (Server)

- Let you Fun Ubuntu desktop eleven weapon (Linux)

- Linux System Getting Started Learning: Linux command in w (Linux)

- Linux command in the dialog whiptail (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:

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:      
 
- Python object-oriented programming (Programming)
- Build ftp server under CentOS 6.5 (Server)
- Linux LVM Logical Volume Management to resize partitions (Linux)
- Intrusion analysis and prevention tools Knark under Linux platform (Linux)
- Getting Started with Linux: Learn how to upgrade Docker in Ubuntu (Server)
- Understand the profound discussion of some of the options for wireless encryption (Linux)
- Using Linux command line and execute PHP code (Programming)
- Awk include binding capacity larger than the specified size of all files directory (Linux)
- No password on Oracle and MySQL login (Database)
- Ubuntu 14.04 / Linux Mint 17 How to install the MintMenu 5.5.2 menu (Linux)
- Linux environment password security settings (Linux)
- Linux / Windows setup is complete port range (Linux)
- Linux serial debugging tools xgcom install (Linux)
- Subsequent binary search tree traversal sequence (Programming)
- Linux basis: a comprehensive study pwd command (Linux)
- Getting Started with Linux system to learn: How to compress JPEG images on the command line (Linux)
- Editor of the popular Linux Gvim (Linux)
- Kubuntu 14.04 desktop to the user how to upgrade KDE 4.13.2 (Linux)
- The Sublime Text 3 configuration file (Linux)
- Linux virtual memory and physical memory (Linux)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.