Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个要求,我需要单击按钮从服务器启动文件下载。我很乐意这样做。我卡住的地方是如果出现错误并且服务器发送不成功的响应,我该如何处理?
问候, 阿马尔
我想你下载了一个带有“Windows.open”的文件,尝试将它包装在一个 try-catch 块中。
try { Window.open("http://127.0.0.1:8888/file.rar", "_self", "enabled"); } catch (Exception t) { // Do something }