If a webView has an impending file download on loading, or it has a link with the parameter download, like:
<a href="#" download="localfile.bin">Download file </a>,
It is not possible to download the file (localfile.bin) into b4j automatically or by clicking the link above.. so that
a SaveAs dialog box appears to prompt for the downloaded file name and location.
While this is possible in system web browser like Chrome.
To reproduce the problem just run the following code:
Is there a workaround?
<a href="#" download="localfile.bin">Download file </a>,
It is not possible to download the file (localfile.bin) into b4j automatically or by clicking the link above.. so that
a SaveAs dialog box appears to prompt for the downloaded file name and location.
While this is possible in system web browser like Chrome.
To reproduce the problem just run the following code:
B4X:
#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI
Private Button1 As B4XView
Private WebView1 As WebView
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
MainForm.Show
Dim html As String=$"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<a href="#" download="local.text" >Download File</a>
</body>
</html>
"$
WebView1.LoadHtml(html)
Wait For WebView1_PageFinished
End Sub
Sub Button1_Click
xui.MsgboxAsync("Hello World!", "B4X")
End Sub