【问题标题】:How to deal with different file types in HTML如何处理 HTML 中的不同文件类型
【发布时间】:2018-05-01 02:52:40
【问题描述】:

我有一个用于下载简单 gif 图像的简单代码。

<a href="file://<path_to_gif>/screenshot.gif" download > <button >Download Source Code</button></a>  

以上代码在windows的chrome浏览器中运行流畅。但是相同的代码在 Mac 中不起作用。如果是 Mac,我应该将代码更改为

<a href="smb://<path_to_gif>/screenshot.gif" download > <button >Download Source Code</button></a>    

如何确保无论使用何种文件系统都可以下载它?

【问题讨论】:

    标签: html windows macos


    【解决方案1】:

    将文件本地添加到您的站点,这样您就可以使用页面中的绝对路径。

    例如

    images/
    index.html
    
    
    index.html = "images/mygif.gif" 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-04-06
      • 2010-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-01
      • 1970-01-01
      相关资源
      最近更新 更多