Html 如何为“创建链接”;将图像另存为";在Rails中下载图像
我想做一个像这样的链接下载Html 如何为“创建链接”;将图像另存为";在Rails中下载图像,html,ruby-on-rails,Html,Ruby On Rails,我想做一个像这样的链接下载 <script> function SaveFile(fname){ img.document.execCommand('saveas', null ,fname) } </script> <iframe id="img" src="myimage.jpg" width="(image width + 20)px" height="(image height + 25)px" scrolling="no" frameborder="0
<script>
function SaveFile(fname){
img.document.execCommand('saveas', null ,fname)
}
</script>
<iframe id="img" src="myimage.jpg" width="(image width + 20)px" height="(image height + 25)px" scrolling="no" frameborder="0px"></iframe>
<button onclick="SaveFile('myimage.jpg');">save as</button>
我试过其他类似的教程
<script>
function SaveFile(fname){
img.document.execCommand('saveas', null ,fname)
}
</script>
<iframe id="img" src="myimage.jpg" width="(image width + 20)px" height="(image height + 25)px" scrolling="no" frameborder="0px"></iframe>
<button onclick="SaveFile('myimage.jpg');">save as</button>
函数保存文件(fname){
img.document.execCommand('saveas',null,fname)
}
另存为
但在FireFox中不起作用
<a href="myimage.jpg">Save As</a>
加上内容处置
标题,将其设置为附件。如果使用Apache,您可以进行调整。
加上内容处置
标题,将其设置为附件。如果使用Apache,您可以进行调整