Android WebView downloads Two of times via HTTP Get download files and solutions

Source: Internet
Author: User

First, the phenomenon

The usual way to download files via the Android WebView is

1. Rewrite the Downloadlistener Ondownloadstart method, pop-up dialog box in Ondownloadstart method prompts the user to have a new file to download

2. After the user clicks OK, downloads the file through the HTTP GET

As a result of the Android WebView, the above download file steps involve two get operations. The first time is when the user clicks on the download link in the WebView, WebView sends the HTTP GET request automatically, this time the server besides sends the file information to send over, will simultaneously send the file the content to the WebView. The second time was initiated in step 2 by a program of your own design.

To verify this, my own browser in the Android 4.4 system accessed and downloaded the test link and Wireshark to see the results. With the following three diagrams, I think it is possible to verify that the same document was actually transmitted two times. Because two different HTTP GET requests can see the successive TCP packets that the server sends to the client.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.