dongwen2162 2018-05-03 20:31
浏览 59
已采纳

图像预览的“保存按钮”[关闭]

I have a website as I describe for you:

When the user opens a page and clicks on the thumbnail image under post title, a preview of that image is displayed.

I want to put a little icon in any corner of the preview for saving the image. This way the user can save the image by clicking on save button.

When I Googled this I found some results and as you can see here, I made that button. But it won't work correctly and now I'm stuck.

Can you please look and tell me where I am going wrong?

http://magezz.com/games/god-of-war-2018-cheats-walkthrough-hints/

  • 写回答

1条回答 默认 最新

  • dongyan7876 2018-05-03 20:51
    关注

    Using HTML5 you can add the attribute 'download' to your links.

    <a href="/path/to/image.png" download>Save Image</a>
    

    Compliant browsers will then prompt to download the image with the same file name (in this example image.png).

    If you specify a value for this attribute, then that will become the new filename:

    <a href="/path/to/image.png" download="AwesomeImage.png">Save Image</a>
    

    UPDATE: As of spring 2018 this is no longer possible for cross-origin hrefs. So if you want to create <a href="https://i.imgur.com/IskAzqA.jpg" download> on a domain other than imgur.com it will not work as intended. Chrome deprecations and removals announcement

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大