通过URL下载图片

时间:2017-02-28 17:53:22

标签: javascript

这是网址:http://www.clipartbest.com/cliparts/Kij/gGE/KijgGEgrT.png

这是我的网页代码:

<html>
<head><title>Some title</title>
<script>
function DownloadUrl(url)
{
// Download that url
}
</script>
<body>
<button onclick="DownloadUrl('http://www.clipartbest.com/cliparts/Kij/gGE/KijgGEgrT.png')">button</button>
</body>
</html>

我的页面和图片网址页面不同。

2 个答案:

答案 0 :(得分:1)

您不需要使用javascript从网址下载文件,您可以使用$(window).on("resize", function() { var maxHeight = 0; $('.sliderBlog').each(function(){ var thisH = $(this).height(); if (thisH > maxHeight) { maxHeight = thisH; } }); $('.sliderBlog').height(maxHeight) } ).resize(); 标记并添加<a> html属性,如下所示:

download

这是最常见的解决方案。

你也可以这样做:

<html>
<head><title>Some title</title>
<body>
<a href="http://www.clipartbest.com/cliparts/Kij/gGE/KijgGEgrT.png" download> Download here! </a>
</body>
</html>

答案 1 :(得分:-1)

试试这个

o["btc"]["usd"]["bitfinex"]["last"].ToString()
相关问题