Is setDownloadListener onDownloadStart called after the webview already Gets the file?

后端 未结 1 1816
庸人自扰
庸人自扰 2021-01-03 10:34

Is it true that the WebView will perform an Http Get and download the complete file then it calls calls my onDownloadStart() method and my code downloads the file ag

相关标签:
1条回答
  • 2021-01-03 11:07

    Its better when a beginn with the answer to your 3. question:

    I think WebView uses GET-method for all Ressources. And only after it gets the first http Headers of this request WebView checks if there are headers that tell "do a download"

    (e.g. headers like Content-Disposition: Attachment; filename=example.html)

    If no header exists which points to a download, WebView will display load and the content in its view.

    onDownload is called if there is a download header (even if its value are set to "inline").

    Answer to question 2:

    I think in that case the webview does NOT load the content of the content. Currently i don`t know a way to reuse the existing request.

    Answer to question 4

    If you overide shouldInterceptRequest

    like in this example: https://stackoverflow.com/a/29811280/2377961 You could change this behavoir.

    0 讨论(0)
提交回复
热议问题