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 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建