[英]Auto-download an image stored in S3 on IOS (Iphone/Ipad) mobile browser
Hope you guys are doing fine.希望你们一切都好。
We are developing a functionality where customers can click on the download button and download an image.我们正在开发一种功能,客户可以单击下载按钮并下载图像。 Image is stored in S3 and a public URL is generated which is kept behind the button.图像存储在 S3 中,并生成一个公共的 URL,它保留在按钮后面。
Something like就像是
<a href="S3Url">Download</a>
Current exp: When customer clicks on the download button Current exp:当客户点击下载按钮时
So need assistance on所以需要帮助
Note:笔记:
Sample:
var downloadElement = document.createElement('a');
downloadElement.href = S3Url;
downloadElement.click();
You can try adding the download
attribute to your links.您可以尝试将download
属性添加到您的链接。 This allows it work correctly for me using Safari.这允许它在我使用 Safari 时正常工作。
Something like this, perhaps:像这样的东西,也许:
var downloadElement = document.createElement('a');
downloadElement.href = S3Url;
downloadElement.download = "filename.jpg";
downloadElement.click();
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.