Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ Android webView URL redirects affect goBack ()     - Linux C source code (sockettype: socket descriptor determination function) (Programming)

- Oracle 11g partition maintenance (two) - Coalescing Partitions (Database)

- RabbitMQ Getting Started Tutorial (Linux)

- Basic Tutorial: Linux novice should know 26 commands (Linux)

- Ubuntu Linux to create and increase the Swap partition tutorial (Linux)

- Using IE can also be easily remotely control the computer (Linux)

- Upload the project to GitHub, synchronous remote repository Github (Linux)

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

- Java object serialization (Programming)

- Easy to get hidden administrator account (Linux)

- Linux installation and configuration curl command tool (Linux)

- Unable to start the network after restart clone a virtual machine (Linux)

- Binding multiple network cards in Linux using command nmcli (Linux)

- Debugging with GDB tool Go (Programming)

- Linux character device - a simple character device model (Linux)

- C / C ++ language usage summary of const (Programming)

- Linux common network tools: Scan routing of mtr (Linux)

- Rely on IP chain established Linux firewall (Linux)

- Gitolite how to import other Git repositories (Server)

- Git use and interpretation of common commands (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.
- Java loop list to solve the problem of Joseph ring (Programming)
- Oracle table Access Control (Database)
- Tmux create the perfect terminal management tool under CentOS (Linux)
- shell script: LVS start simple script (Server)
- CentOS7 iptables (Linux)
- Install the latest Eclipse IDE in Ubuntu (Linux)
- Swift 2.0 brief (Linux)
- Install Ubuntu open source drawing program MyPaint 1.2.0 (Linux)
- Storm how to ensure that at least once semantics (Programming)
- C ++ 11 smart pointers (Programming)
- Android memory optimization of the optimal load Bitmap (Linux)
- How to use Xmanager Remote Desktop and VNC Log (Linux)
- DVD production using CentOS installation source within the company Yum (Linux)
- Sublime Text 3 (Linux)
- Oracle database online redo logs are several methods of recovery of deleted (Database)
- Using Linux command line and execute PHP code (Programming)
- Tip: Use Cryptsetup U disk encryption (Linux)
- Modify Linux SSH default port 22 in several ways (Linux)
- CentOS 7 open ports (Linux)
- Linux character device - a simple character device model (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.