在iPhone上使用Google Chrome下载ICS文件

Pab*_*blo 7 javascript iphone icalendar google-chrome ios

我的服务器上存储了一个ICS文件("text/calendar"MIME类型).

在JavaScript中我打电话:

window.open("/path/to/file.ics");
Run Code Online (Sandbox Code Playgroud)

它适用于所有浏览器,甚至可以在iPhone上的Safari上运行,但是当我尝试使用Chrome(iPhone版)时,没有任何反应,没有任何下载,屏幕上没有错误,什么也没有.

也许有人曾经去过那里,并有任何建议.提前致谢!

Tho*_*hor 0

还应该可以使用旧的创建下载链接,将其附加到文档,单击它,然后将其删除的技巧。

let icsLink = document.createElement("a");
icsLink.style.display = "none";
icsLink.href = "/path/to/file.ics";
icsLink.setAttribute("download","download");
document.body.appendChild(icsLink);
icsLink.click();
document.body.removeChild(icsLink);
Run Code Online (Sandbox Code Playgroud)