我正在使用 flutter_webview_plugin 包来显示网页。在网页上,我们有一个下载文件的功能。下载文件的逻辑类似于下面的代码
filename = "my-file.txt"
content = 'any string generated by django'
response = HttpResponse(content, content_type='text/plain')
response['Content-Disposition'] = 'attachment;filename={0}'.format(filename)
print(response)
return response
当它在浏览器中直接调用时它工作正常,但在 Flutter Webview 中没有任何效果。有什么需要手动处理的吗?即使我愿意更改包。我也尝试了flutter_inappwebview,但没有区别。我不想启动任何浏览器的 URL,我只想直接从应用程序下载。可以这样做吗?